add file to project problem.
-
Hi all! I made a dialog base application and wanted to use a class I wrote before. I copied the header file and the implementation file to the project folder and use "add files to project" option to add these 2 files. These 2 files are actually working files. However, when I tried to recompile the project, it kept giving me this error. ------Configuration: MyProject - Win32 Release---------- Compiling... controllerList.cpp D:\MyProject\MyPoint.cpp(188) : fatal error C1010: unexpected end of file while looking for precompiled header directive Error executing cl.exe. Does any one know what is wrong here? Thank You Vu The class is very simple. If you need to have a look, here it is: //--------------------- myPoint.h //--------------------- #ifndef MYPOINT_H #define MYPOINT_H class MyPoint { private: int x,y; public: MyPoint(); ~MyPoint(); void setPoint(int,int); int getX(); int getY(); }; #endif //--------------------- myPoint.cpp //--------------------- #include "MyPoint.h" MyPoint::MyPoint() { x= 0; y=0; } MyPoint::~MyPoint() { x=-1; y=-1; } int MyPoint::getX() { return x; } int MyPoint::getY() { return y; } void MyPoint::setPoint(int x1,int y1) { x= x1; y = y1; } vucsuf
-
Hi all! I made a dialog base application and wanted to use a class I wrote before. I copied the header file and the implementation file to the project folder and use "add files to project" option to add these 2 files. These 2 files are actually working files. However, when I tried to recompile the project, it kept giving me this error. ------Configuration: MyProject - Win32 Release---------- Compiling... controllerList.cpp D:\MyProject\MyPoint.cpp(188) : fatal error C1010: unexpected end of file while looking for precompiled header directive Error executing cl.exe. Does any one know what is wrong here? Thank You Vu The class is very simple. If you need to have a look, here it is: //--------------------- myPoint.h //--------------------- #ifndef MYPOINT_H #define MYPOINT_H class MyPoint { private: int x,y; public: MyPoint(); ~MyPoint(); void setPoint(int,int); int getX(); int getY(); }; #endif //--------------------- myPoint.cpp //--------------------- #include "MyPoint.h" MyPoint::MyPoint() { x= 0; y=0; } MyPoint::~MyPoint() { x=-1; y=-1; } int MyPoint::getX() { return x; } int MyPoint::getY() { return y; } void MyPoint::setPoint(int x1,int y1) { x= x1; y = y1; } vucsuf
Add #include "stdafx.h" to the top of your file Nish
-
Hi all! I made a dialog base application and wanted to use a class I wrote before. I copied the header file and the implementation file to the project folder and use "add files to project" option to add these 2 files. These 2 files are actually working files. However, when I tried to recompile the project, it kept giving me this error. ------Configuration: MyProject - Win32 Release---------- Compiling... controllerList.cpp D:\MyProject\MyPoint.cpp(188) : fatal error C1010: unexpected end of file while looking for precompiled header directive Error executing cl.exe. Does any one know what is wrong here? Thank You Vu The class is very simple. If you need to have a look, here it is: //--------------------- myPoint.h //--------------------- #ifndef MYPOINT_H #define MYPOINT_H class MyPoint { private: int x,y; public: MyPoint(); ~MyPoint(); void setPoint(int,int); int getX(); int getY(); }; #endif //--------------------- myPoint.cpp //--------------------- #include "MyPoint.h" MyPoint::MyPoint() { x= 0; y=0; } MyPoint::~MyPoint() { x=-1; y=-1; } int MyPoint::getX() { return x; } int MyPoint::getY() { return y; } void MyPoint::setPoint(int x1,int y1) { x= x1; y = y1; } vucsuf
Vu You have to either turn off use of precompiled headers or enable your class to use precompiled headers. To turn off Precompiled Headers got to the menu. Select Project -> Settings..., select the C/C++ tab. Select Precompiled Headers from the dropdown combobox. Here you select Not using precompiled headers. To enable your class to use Precompiled Headers add
#include "stdafx.h"
to the top off you classes header file before all other #include statements. Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone
-
Vu You have to either turn off use of precompiled headers or enable your class to use precompiled headers. To turn off Precompiled Headers got to the menu. Select Project -> Settings..., select the C/C++ tab. Select Precompiled Headers from the dropdown combobox. Here you select Not using precompiled headers. To enable your class to use Precompiled Headers add
#include "stdafx.h"
to the top off you classes header file before all other #include statements. Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone