Solved

Using c library  in VC++ Project

Posted on 2002-07-11
7
278 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
7 Comments
 
LVL 30

Expert Comment

by:Axter
ID: 7147766
Try adding the following to the top of the *.c file:

#include "stdafx.h"
0
 
LVL 30

Expert Comment

by:Axter
ID: 7147773
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
ID: 7147809
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!

 
LVL 86

Expert Comment

by:jkr
ID: 7147821
Delete GUI.pch, and it should work.
0
 
LVL 3

Author Comment

by:jsaxon2
ID: 7147824
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
ID: 7147834
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
ID: 7147893
Worked perfect. Thank you very much.
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

628 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