Solved

Using c library  in VC++ Project

Posted on 2002-07-11
7
238 Views
Last Modified: 2006-11-17
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
Comment
Question by:jsaxon2
  • 3
  • 2
  • 2
7 Comments
 
LVL 30

Expert Comment

by:Axter
Comment Utility
Try adding the following to the top of the *.c file:

#include "stdafx.h"
0
 
LVL 30

Expert Comment

by:Axter
Comment Utility
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
 
LVL 3

Author Comment

by:jsaxon2
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 86

Expert Comment

by:jkr
Comment Utility
Delete GUI.pch, and it should work.
0
 
LVL 3

Author Comment

by:jsaxon2
Comment Utility
I deleteed the file and did a rebuild all and I still am getting the error. Anything else I could try?
0
 
LVL 86

Accepted Solution

by:
jkr earned 200 total points
Comment Utility
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
 
LVL 3

Author Comment

by:jsaxon2
Comment Utility
Worked perfect. Thank you very much.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now