|
-
February 19th, 2010, 07:11 PM
#1
problem include my class in a win32 project
Hi,
I am experiencing strange behavior when tring to compile a projetc. I created a new win32 Project that comes with a "stdafx.h" and "stdafx.cpp" files. The entry point of the app "int APIENTRY _tWinMain()" is in the main.cpp file which include the stdafx.h and main.h files at the beginning.
the main.h file contains this:
Code:
#pragma once
#include "resource.h"
Now, I thought I'd add two more files for a class a created: myclass.h and myclass.cpp and for the time being I just declared a simple void f(void); function in the header file and its definition void f(void) {}; in the .cpp file.
I thought I'd just need to add myclass.h to the main.cpp file to take advantage of my class. Yet, I am getting this error:
(myclass.h) warning C4627: '#include "showListeners.h"': skipped when looking for precompiled header use
(myclass.cpp) fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?
where do I have to include "myclass.h" ???
thanks
-
February 19th, 2010, 08:12 PM
#2
Re: problem include my class in a win32 project
stdafx.h should be the first header file in all of the cpp files in your project. If you don't want to add it to your cpp file, then right-click on the file in the solution explorer, select properties then go to C++ -> precompiled headers and set it to off (it only affects that file).
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|