Click to See Complete Forum and Search --> : Fatal Errors urgent help needed


cyberone
August 12th, 2004, 02:05 AM
Hi all

I'm using Win xp , visual studio 2003.
I developed one Atl project with simple object and added a single method for that . Upto this point every thing is fine . (Now I need my another Console Application 's functions to be used in this component) So I added those 'C' files to my project and doesn't associated any function referece yet.
But When I Compiled the project I was facing the following errors

d:\SimCom\TraceLog.c(31) : fatal error C1010: unexpected end of file while looking for precompiled header directive

The above errors occur for all the included 'C' files.

Where I'm commiting the mistake . Plz Let me know.

Adv Thanx

Cyberone :(

SreeDharan
August 12th, 2004, 02:52 AM
ask ur compiler not to look for a precompiled header :)

Go to project settings(ALT+F7)
Select C/C++ Tab
Select Precompiled Headers in the "category" combo box
Select Not using precompiled headers radio button
Press OK
Rebuild



Hi all

I'm using Win xp , visual studio 2003.
I developed one Atl project with simple object and added a single method for that . Upto this point every thing is fine . (Now I need my another Console Application 's functions to be used in this component) So I added those 'C' files to my project and doesn't associated any function referece yet.
But When I Compiled the project I was facing the following errors

d:\Rajesh\SimCom\TraceLog.c(31) : fatal error C1010: unexpected end of file while looking for precompiled header directive

The above errors occur for all the included 'C' files.

Where I'm commiting the mistake . Plz Let me know.

Adv Thanx

Cyberone :(

cyberone
August 12th, 2004, 03:39 AM
Thanx SreeDharan

for ur reply I ve done it and no more fatal errors but this time with the linker errors

I changed my main function of the console to Chgmain and then declared it in the corres header file and included in the simpl object source file.
And referenced it in one of my methods (GenChg) . I'm facing the below errors,

error LNK2019: unresolved external symbol "int __cdecl Chgmain(char *)" (?Mapmain@@YAHPAD@Z) referenced in function "public: virtual long __stdcall Chgserver::GenChg(unsigned short *)" (?GenChg@Chgserver@@UAGJPAG@Z)
Debug/SimCom.dll : fatal error LNK1120: 1 unresolved externals


Thanx in Advance
Cyberone

SreeDharan
August 12th, 2004, 03:57 AM
sorry i don't know

sbubis
August 12th, 2004, 06:00 AM
Do you mix C and C++ files in your project?

cyberone
August 12th, 2004, 06:07 AM
yes

Because I want to make a wrapper object for my working C console application .
So I created the ATL project and added the C source files in it.

sbubis
August 12th, 2004, 06:14 AM
In that case you should use extern "C" syntax whenever you compile C++ source code.
Read "Mixed-Language Programming with C++" topic in MSDN.

smee
August 12th, 2004, 09:42 AM
If you are just mixing C and C++ source code to build an app, then adding the /Tp compile switch will fix the problem.

It forces the compiler to ignore file extension (.c or .cpp) and compile everything with decorated names. The linker will be happy.

If you will effectively be calling C++ from C then as sbubis says, use extern "C" to tell the compiler not to decorate.

Ooh.. my first post :)

cyberone
August 13th, 2004, 05:50 AM
Hi smee

Thank you for your reply !! :)

If you are just mixing C and C++ source code to build an app, then adding the /Tp compile switch will fix the problem.

/ Tp switch tells the compiler to compile the project as C++ compiler :confused:

It forces the compiler to ignore file extension (.c or .cpp) and compile everything with decorated names. The linker will be happy.

Anyhow I ve used the following in my header files


#ifdef __cplusplus
extern "C"
{
#endif


at the start and the following in the end,


#ifdef __cplusplus
}
#endif


But No effect still the error occurs LNK2019 :cry:


Any how thanx for ur first post :wave:

regards
Cyberone