Jump to content

C++ errors


PcWizKid
 Share

Recommended Posts

I just wrote the simple program in c++ and tried compiling it I keep getting a few errors that i cant seem to fix.

 

here is my code:

#include "Engine.h"

 

int main(int argc, char** argv)

{

//Load engine Dll

Initialize();

 

//Create Main Game graphics window

Graphics (800,600,0,0,GRAPHICS_BACKBUFFER+GRAPHICS_DEPHBUFFER);

 

//Create World

;CreateWorld();

 

//Create a camera

TEntity cam;

cam=CreateCamera(0);

MoveEntity(cam,Vec3(0,0,-5));

 

//Create Cube

CreateCube(0);

 

//MainLoop

while (!KeyHit(KEY_ESCAPE)) {

//UpdateWorld

UpdateWorld(1);

 

//Render the world

RenderWorld(RENDER_ALL);

 

//FLip Buffer

Flip(1);

 

}

 

Terminate();

 

return 0

 

 

}

 

 

 

 

}

 

 

 

 

and here are the errors im getting

1>------ Build started: Project: DarkAge, Configuration: Debug Win32 ------

1>Compiling...

1>DarkAge.cpp

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(20) : error C2065: 'GRAPHICS_DEPHBUFFER' : undeclared identifier

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(51) : error C2143: syntax error : missing ';' before '}'

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(56) : error C2059: syntax error : '}'

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(56) : error C2143: syntax error : missing ';' before '}'

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(56) : error C2059: syntax error : '}'

1>Build log was saved at "file://c:\Users\PointerSoftworks\Desktop\Projects\DarkAge\DarkAge\Debug\BuildLog.htm"

1>DarkAge - 5 error(s), 0 warning(s)

========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Link to comment
Share on other sites

The error console says it all

 

1. GRAPHICS_DEPHBUFFER should be GRAPHICS_DEPTHBUFFER (You missed the 'T')

 

2. and ;CreateWorld(); should be CreateWorld (); (Don't put a semi colon before CreateWorld().......

 

3. You have too many of } these. Parenthesis always need to match up.so delete the last one

 

 

You should learn what the error messages mean. eg:

error C2065: 'GRAPHICS_DEPHBUFFER' : undeclared identifier

means that the compiler doesn't know what GRAPHICS_DEPHBUFFER is..... first thing to do is to check your spelling because it has to be exact or the computers not gonna guess what you meant

 

1>c:\users\pointersoftworks\desktop\projects\darkage\darkage\darkage.cpp(51) : error C2143: syntax error : missing ';' before '}'

Syntax errors usually come down to missing a ; or having mis-matching parenthesis ({}) etc. Double click on the error messages and it should show you exactly where they problem is in most of these cases.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

now a error box is popping up saying

 

"Unhandled exception at 0x00000000 in DarkAge.exe: 0xC0000005: Access violation."

 

Hmm the only thing I can see is this: #include "Engine.h" It should read #include "engine.h"

 

C++ is case sensitive so you need to specify it it exactly as its written. Also make sure you set up your VC++ project correctly.

 

Have you used C++ before or is this your first time?

If you haven't used it much before I would suggest going to www.cprogramming.com and do the c++ beginners tutorial and getting some of the basics down. It will help you get to know it better.

STS - Scarlet Thread Studios

AKA: Engineer Ken

 

Fact: Game Development is hard... very bloody hard.. If you are not prepared to accept that.. Please give up now!

Link to comment
Share on other sites

Hi PcWizKid

 

I can see that you are new to C++ programming. Nothing bad about that, you are welcome ;)

Everyone has to start somewhere. Here is my recommendation to you.

 

  1. Use the LEBuilder to create a C++ project for you. This way you will be sure that everything is correctly setup regarding Visual Studio files and paths.
  2. Study the created 'rotating cube' sample so you understand whats going on.
  3. If there are things that you doesn't understand in that sample don't shy to ask in the forum. We will help
  4. When you understand the sample you can wipe out the sample code and replace it with your own, or change the sample code at your desires.

 

Good luck

Roland

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...