Link to home
Start Free TrialLog in
Avatar of jsaxon2
jsaxon2

asked on

Using c library in VC++ Project

I am trying to use a library written in c within a c++ program. I am getting an error:
c:\mad_test\msvc++\gui\player.c(2021) : fatal error C1010: unexpected end of file while looking for precompiled header directive

I know that the error is being caused because it is a c file in a cpp program, but what I need to know is how do I make it work.

Thanks in advance,
John
Avatar of Axter
Axter
Flag of United States of America image

Try adding the following to the top of the *.c file:

#include "stdafx.h"
The error  you posted is not related to the file been a *.c file.
The error has to do with your project precompile header options.
Avatar of jsaxon2
jsaxon2

ASKER

I get this error when I add #include "stdafx.h" to the top of the .c file:

c:\mad_test\msvc++\gui\player.c(21) : fatal error C1853: 'Debug/GUI.pch' is not a precompiled header file created with this compiler
Error executing cl.exe.
Delete GUI.pch, and it should work.
Avatar of jsaxon2

ASKER

I deleteed the file and did a rebuild all and I still am getting the error. Anything else I could try?
ASKER CERTIFIED SOLUTION
Avatar of jkr
jkr
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jsaxon2

ASKER

Worked perfect. Thank you very much.