Sign in to follow this  

LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main reference error

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

I am tryting to right a simple opengl program but i get this error "LIBCD.lib(crt0.obj) : error LNK2019: unresolved external symbol _main referenced in function _mainCRTStartup" I was wondering what setting do i put it on for opengl (not seted up window with win32 and use OGL, just plain OGL) do i make a win32 console project first and then in wizard go to the tab and select windows, or do i select a win32 project and select console window in the wizard tabb? I am using Visual C++ .NET Here is the code: <code> #include <windows.h> #include <gl/glut.h> void RenderScene(void) { // Clears the window with the current clearing color glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Flush drawing commands glFlush(); } void SetupRC(void) { glClearColor(0.0f, 0.0f, 1.0, 1.0); } //Main Program Entry Point void Main(void) { glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB); glutCreateWindow("Simple"); glutDisplayFunc(RenderScene); SetupRC(); glutMainLoop(); } </code>

Share this post


Link to post
Share on other sites
If you want make it a console app:
int main(void)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
//etc
}


If its a windows app:
INT WINAPI WinMain(HINSTANCE hinst,HINSTANCE hprev,LPSTR wp,INT cmdshow)
{
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
//etc
}

Share this post


Link to post
Share on other sites
So if I want it to be a console I go to project >> name properties >> C++ >> prepocessor definition << and change fomr WIN32;_DEBUG;_WIN32 TO WIN32;_DEBUG;_CONSOLE, and then go to linker >> system >> sub system << and chanhge it from Console (/SUBSYSTEM:CONSOLE) to Console (/SUBSYSTEM:WIN_32? Right so thier opposites or is this process vise -versa?

Share this post


Link to post
Share on other sites

This topic is 4244 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this