Solved

precompiled headers problem

Posted on 2004-08-31
7
314 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

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

Suggested Solutions

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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

737 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