Advertisement

Need help by classes

Started by November 30, 2001 12:03 PM
4 comments, last by Ethan 22 years, 11 months ago
I would create classes in VC++6.0 Standart and it won''t work -I have start an new Project (Win32 Application, Name: Win32) -Selected the "A simple Win32 application" -I''ve added a new header (opengl.h) and a new source (opengl.cpp) -I added following text in the header of (opengl.h): #ifndef OPENGL_H #define OPENGL_H #include "StdAfx.h" class engine{ public: int x; int Y; void SwapType(); }; #endif -At opengl.cpp i''ve added: #include "opengl.h" void engine::SwapType(){ int temp=x; x=y; y=temp; } -and at the main routine if added this: ENGINE engine; engine.x =12; engine.y =13; engine.SwapType(); I always get an error.
We can't help unless you tell us what error you get.

Edit: Actually I see one BIG problem, which is that you are creating a Win32 application instead of a Win32 console application.

Edited by - Fruny on November 30, 2001 1:30:36 PM
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Advertisement
Also, your class name is engine, not ENGINE.

It should be:

engine eng;
eng.x=12;
eng.y=13;
eng.SwapType();
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][LWJGL Tutorials for NeHe][LWJGL Wiki][jMonkey Engine]
the error i get is in the opengl.cpp at the last line

-fatal error C1010: unexpected end of file while looking for precompiled header directive
I''m not sure, but you either need to turn precompiled headers OFF(don''t ask me how) or just include stdafx.h in your main cpp file.
quote: Original post by Anonymous Poster
...turn precompiled headers OFF...

Project->Settings->C/C++->[drop-down]Category: Precompiled Headers->[radio]Not Using Precompiled Headers.

Start Here!

This topic is closed to new replies.

Advertisement