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,
Who is Participating?
jkrConnect With a Mentor Commented:
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"....
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.
7 new features that'll make your work life better

It’s our mission to create a product that solves the huge challenges you face at work every day. In case you missed it, here are 7 delightful things we've added recently to monday to make it even more awesome.

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