Jump to content
  • Advertisement
Sign in to follow this  
Mr_Fhqwhgads

OpenGL Unexpected end of line

This topic is 4825 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well, I did the first NeHe tutorial. It all went perfectly, exept in my main cpp file I get unexpected end of file error. I went trhough the code already and check that all the braces were in place, all the quotation marks, and ; where there. But I cannot seem to find a problem.
#include "PrimitivePong2.h"



//All drawing code goes here
int DrawGLScene(GLvoid){
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
	glLoadIdentity();
	return true;
}

//Our Main function
//Window creation routine
int WINAPI WinMain(		HINSTANCE	hInstance,
						HINSTANCE	hPrevInstance,
						LPSTR		lpCmdLine,
						int			nCmdShow){
	MSG msg;
	bool	done=false;

	//Which screenmode they want
	if(MessageBox(NULL,"Do you want Fullscreen mode?","Primitive Pong 2",MB_YESNO|MB_ICONQUESTION)==IDNO){
		fullscreen=false;
	}

	//create our opengl window
	if(!CreateGLWindow("Primitive Pong 2",800,600,32,fullscreen)){
		return 0;
	}

	//Game Loop Woot
	while(!done){
		
		//check messages
		if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)){
			if(msg.message==WM_QUIT){
				done=true;
			} else {
				TranslateMessage(&msg);
				DispatchMessage(&msg);
			}
		} else {
			
			//check ESC key
			if(active){
				if(keys[VK_ESCAPE]){
					done=true;
				} else{
					DrawGLScene();
					SwapBuffers(hDC);
				}
			
		}

			if(keys[VK_F1]){
				keys[VK_F1]=false;
				KillGLWindow();
				fullscreen=!fullscreen;
				if(!CreateGLWindow("Primitive Pong 2",800,600,32,fullscreen)){
					return 0;
				}

			}

	}

	//clean up
		KillGLWindow();
		return(msg.wParam);
}

Share this post


Link to post
Share on other sites
Advertisement
I don't thinkso becuase after I add a closing brace I get these 15 errors *rolls eyes*

Quote:

Linking...
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glClear@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol _gluPerspective@32
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glViewport@16
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glHint@8
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glDepthFunc@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glEnable@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glClearDepth@8
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glClearColor@16
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__glShadeModel@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
PrimitivePong2.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
Debug/PrimitivePong2.exe : fatal error LNK1120: 14 unresolved externals
Error executing link.exe.

Share this post


Link to post
Share on other sites
You don't seem to know the difference between a compilation error and a linker error. Put simply syntax errors cause compiler errors, linker errors are down to your project settings. Like vNistelrooy says, you just need to tell the linker to link the libraries containing those unresolved symbols.

Share this post


Link to post
Share on other sites
Ok, I got it... I needed....

OpenGL32.lib GLu32.lib and GLaux.lib

I thought I already had those in the link.... thats why i never bothered checking that.


**EDIT**
after everytime I run the program, I have to go to CTRL-ALT-Deleate and end proccess, becuase I can't compile, because the program is still running. Any ideas? I followed NEHEs tutorail.......

[Edited by - Mr_Fhqwhgads on August 1, 2005 1:51:36 PM]

Share this post


Link to post
Share on other sites
PostQuitMessage(0);

Hmm, odd.. why are you using WinMain with SDL anyways? I would think the point to use SDL would be to avoid that and all Win32.

Share this post


Link to post
Share on other sites
Quote:
Original post by Name_Unknown
why are you using WinMain with SDL anyways?

He's not.

Mr_Fhqwhgads: are you saying hitting escape doesn't exit the program? If so, can you see which bit of the code is meant to check for esc being pressed (you should be able to easily) and work out why it's not being called?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!