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
LVL 3
jsaxon2Asked:
Who is Participating?
 
jkrCommented:
Hmm, the emergency method: Go to the properties of the C file (in the file view, select it and right-click), choose the C++ tab, pick "Precompiled Headers" in the ComboBox and select "No precompiled headers"....
0
 
AxterCommented:
Try adding the following to the top of the *.c file:

#include "stdafx.h"
0
 
AxterCommented:
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.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
jsaxon2Author Commented:
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.
0
 
jkrCommented:
Delete GUI.pch, and it should work.
0
 
jsaxon2Author Commented:
I deleteed the file and did a rebuild all and I still am getting the error. Anything else I could try?
0
 
jsaxon2Author Commented:
Worked perfect. Thank you very much.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.