Jump to content

  • Log In with Google      Sign In   
  • Create Account


Help me with that error please!


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 03 May 2014 - 03:42 AM

Hello everyone,

I'm learning Nehe tutorials and I came across with an error: "entry point must be defined" file: "LINK"

This is my code:

#include <Windows.h>
#include <gl\GL.h>
#include <gl\GLU.h>
#include <gl\GLAux.h>

HGLRC           hRC = NULL;                        
HDC             hDC = NULL;

bool keys[256];
bool active = TRUE;
bool fullscreen = TRUE;

LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);

GLvoid ReSizeGLScene(GLsizei width, GLsizei height)
{
	if (height == 0)
	{
		height = 1;
	}

	glViewport(0, 0, width, height);
	glMatrixMode(GL_PROJECTION);                        
	glLoadIdentity();                           

	
	gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f);

	glMatrixMode(GL_MODELVIEW);                   
	glLoadIdentity();                        
}

int InitGL(GLvoid){
	glShadeModel(GL_SMOOTH);
	glClearColor(1.0f, 1.0f, 1.0f, 0.0f);
	glClearDepth(1.0f);
	glEnable(GL_DEPTH_TEST);
	glDepthFunc(GL_LEQUAL);
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
	return TRUE;
}

Help me to figure it out please

 



Sponsor:

#2 haegarr   Crossbones+   -  Reputation: 3896

Like
5Likes
Like

Posted 03 May 2014 - 03:55 AM

The "entry point" is also known as main function. Under Windows this is usually WinMain(…), while under unixes it is usually main(…). Without such a function anywhere within your code, the compiler does not know what to call when the OS hands over program execution to your executable. Either you complete the shown code snippet by an appropriate main function, or else you need to compile it as object file and link it with another object file where the main function was compiled into. 



#3 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 03 May 2014 - 05:02 AM

The "entry point" is also known as main function. Under Windows this is usually WinMain(…), while under unixes it is usually main(…). Without such a function anywhere within your code, the compiler does not know what to call when the OS hands over program execution to your executable. Either you complete the shown code snippet by an appropriate main function, or else you need to compile it as object file and link it with another object file where the main function was compiled into. 

I still not sure what to do. if you could explain me in more details I will be very glad.

Thank you



#4 radioteeth   Prime Members   -  Reputation: 956

Like
1Likes
Like

Posted 03 May 2014 - 05:39 AM

I would recommend downloading the finished code that you can find at the end of each tutorial, and comparing it to your code.



#5 rip-off   Moderators   -  Reputation: 7963

Like
2Likes
Like

Posted 03 May 2014 - 05:40 AM

What part of haegarr's reply are you having difficulty with?

You need to add a main() / WinMain() function, probably the latter given that you have declared WndProc(). Given that you saying you're following NeHe, have you fully read the first tutorial? There is a WinMain() implementation in it. It appears you're only using the first portion of the code, it is all necessary to have a complete, runnable program.

#6 haegarr   Crossbones+   -  Reputation: 3896

Like
1Likes
Like

Posted 03 May 2014 - 05:41 AM

I still not sure what to do. if you could explain me in more details I will be very glad.

Telling you what exactly to do requires knowledge of your project set-up. Moreover I'm not a Windows programmer but one working under Unix.

 

However, in principle you need to implement a function WinMain (because you're building a Windows executable). The legacy NeHe tutorials have this function explained in tutorial 01, and I assume that the tutorials you are following have this, too. Later tutorials may have dropped it for clarity, but when you download the tutorial instead of copying it from screen you probably found WinMain therein. I don't know which tutorials / source you are following, so I cannot hint you exactly where to look.

 

EDIT: Being ninja'd twice… ;)


Edited by haegarr, 03 May 2014 - 05:43 AM.


#7 ByteTroll   Prime Members   -  Reputation: 1221

Like
1Likes
Like

Posted 03 May 2014 - 07:45 AM

As everyone else has mentioned, you need an entry point.  Otherwise, where does the program start?  Seeing as you declared a message proc, you want:

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow ) {

//Do stuff here.

return 0;
}

You will also need to check the message queue and handle those messages in the main function.


▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬
I see the future in 1's and 0's
▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

#8 LiziPizi   Members   -  Reputation: 74

Like
0Likes
Like

Posted 03 May 2014 - 08:18 AM

Thanks everyone



#9 Kaptein   Prime Members   -  Reputation: 1947

Like
4Likes
Like

Posted 03 May 2014 - 09:07 AM

Also NeHe's tutorials are SEVERELY outdated to the point of being completely irrelevant today.

There are better modern tutorials out there.

 

For example:

http://www.arcsynthesis.org/gltut/






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS