?
Solved

precompiled headers problem

Posted on 2004-08-31
7
Medium Priority
?
316 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 400 total points
ID: 11940500
put #include "stdafx.h" as first line of entity.cpp
0
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

 
LVL 16

Assisted Solution

by:nonubik
nonubik earned 100 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month13 days, 14 hours left to enroll

800 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