Jump to content
  • Advertisement
Sign in to follow this  
TheSeb

problem with visual c++ 7 : fatal error LNK1561: entry point must be defined

This topic is 4770 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

Hi ! with VC++ 7 i have this error : fatal error LNK1561: entry point must be defined and i don't know what to do. It works well with vc++ 6 but not with vc++ 7. these are my header and my main function :
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <fstream>
#include <math.h>
#include <string.h>
#include <glew.h>
#include <glut.h>
#include <sdl.h>
//#include <gl.h>
//#include <glext.h>
#include <SDL_image.h>
using namespace std;


#pragma comment( lib,"sdl.lib")
#pragma comment( lib,"sdlmain.lib")
#pragma comment( lib, "SDL_image.lib")
#pragma comment( lib, "glew32.lib")
#pragma comment( lib, "glut32.lib")

int main(int argc, char *argv[])
{
	myLoader= new loader3ds() ;
	glutInit (&argc, argv) ;
	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH) ;
	glutInitWindowSize (640, 640) ;
	glutInitWindowPosition (250,250) ;
	glutCreateWindow (argv [0]) ;
	glewInit();

	glEnable( GL_DEPTH_TEST );
	glClearColor(0, 0, 1, 0);
	
	myLoader->lighting() ;
	myLoader->loadTextures() ;
	
	glutReshapeFunc (reshape) ;
	
	glutKeyboardFunc (keyboard) ;
	glutDisplayFunc (display) ;
	glutIdleFunc(display);

	loadShader *myShaderLoader = new loadShader("vertexShader.vert", "fragmentShader.frag");
	//loadShader *myShaderLoader = new loadShader("toon.vert", "toon.frag");

	glutMainLoop () ;
	return 0 ;
}

Share this post


Link to post
Share on other sites
Advertisement
Given your code, the only reason I can think for this happening is if you accidently set the project to build a DLL instead of an EXE. Check your build settings for what kind of target you are outputting. Or just create a new blank application and paste your code in.

Share this post


Link to post
Share on other sites
If I recall correctly SDL also requires you to compile as "Multithreaded DLL".

SDL replaces your main function with it's own main function provided by sdlmain.lib. The "entry point must be defined" means that the linker can't find the main/winmain function in sdlmain.lib

Share this post


Link to post
Share on other sites
i have ever set the option as multithreaded DLL :-(
I have created a new blank application and now i have this error :

fatal error C1010: unexpected end of file while looking for precompiled header directive

and the line which is indicated is just after the end of the main function.

Share this post


Link to post
Share on other sites
To use PCH in MSVC, you have to include the PCH header file before anything else. Another thing to watch out for is that VS will ignore everything in a file before the PCH header.

Share this post


Link to post
Share on other sites
PCH stands for precompiled header. When used correctly, they can drastically speed up your compile times.

Share this post


Link to post
Share on other sites
Go to Project Properties, C/C++, Precompiled Headers and change the setting to not using precompiled headers.

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!