Solved

precompiled headers problem

Posted on 2004-08-31
7
315 Views
Last Modified: 2010-04-24
hi there,

i have a strange problem compiling a very simple project.
details: I have created a new project, console application, not empty project. So i have the files main.cpp, stdafx.cpp , stdafx.h.
Now a simple class is added. Files: entity.h and entity.cpp (through 'Add existing item') Source:

entity.h :

#if !defined(ENTITY_H_)
#define ENTITY_H_

#include "stdafx.h"

using namespace std;

class MM_Entity
{
public:
      MM_Entity( void );
      ~MM_Entity( void );
      bool FromFile( char* filename );

private:
      string m_name;
      string m_pkey;
      vector<string> m_fkeys;
      vector<string> m_attributes;
};

#endif

entity.cpp:

#include "entity.h"

MM_Entity::MM_Entity( void ) : m_fkeys(NULL), m_attributes(NULL)
{

}

MM_Entity::~MM_Entity( void )
{

}

bool MM_Entity::FromFile(char* filename)
{
      return true;
}

Now, when I try to compile I get the error : Unexpected end of file while looking for precompiled header.
Turning off 'Use precompiled header' in project settings ist not the solution. other problems arise then.
What am i missing here?

thanks in advance

mcfly
0
Comment
Question by:g_mcfly
[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
  • 3
7 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11940409
Hi g_mcfly,

> #if !defined(ENTITY_H_)
> #define ENTITY_H_

//resst of file

#endif  <-- this is missing ... add #endif as last line of the file

Sunnycoder
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 11940413
oops ... missed the #endif in your code ...
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 100 total points
ID: 11940500
put #include "stdafx.h" as first line of entity.cpp
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.

 
LVL 16

Assisted Solution

by:nonubik
nonubik earned 25 total points
ID: 11940714
and remove it from entity.h
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11940733
Or, if you don't want to use precompiled headers, select entity.cpp in the workspace area, rightclik, select settings, go to C/C++ tab, 'Precompiled headers' in combo, select then 'not using precompiled headers'.
0
 
LVL 16

Expert Comment

by:nonubik
ID: 11940746
Do not mind my above comment. :o)

I meant -> rightclick entity.cpp in the solution explorer -> properties -> C/C++ -> precompiled headers -> 'not using...' in first combo
0
 

Author Comment

by:g_mcfly
ID: 11941222
thanks to both of you
0

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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