Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 280
  • Last Modified:

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
0
jsaxon2
Asked:
jsaxon2
  • 3
  • 2
  • 2
1 Solution
 
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
 
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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 
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
 
jsaxon2Author Commented:
Worked perfect. Thank you very much.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now