Thread: LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

  1. #1
    Registered User
    Join Date
    Nov 2006
    Posts
    19

    Unhappy LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16

    Compiling my first tutoriol/program, goes fine. Building gives this error:

    Linking...
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/helwld.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    Creating browse info file...

    helwld.exe - 2 error(s), 0 warning(s)

    I am new to C++ but have followed the directions on the tutorial, whcih says: to set the options>idirectories>include "\include directory of the Irrlicht Engine ", and to clcik libraries and put in the library path for VS studio in for the same machine above.s After researching I also Ihave put the Irrlicht.lib in the project settings link list as well.

    This is an xp running VS 6.0 C++

    I dont know what else to add...

    [B]OH ohB]the tutorial said if you get the first error then you have done the options/directories include wrong, but I have checked it several times....

    I have searched the msdn for info on the #pragmatic statement too, and all looks acurater there...

    Thanks for any help
    iti

    Code:
      
     // helwld.cpp : Defines the entry point for the application.
    //
    
    #include "stdafx.h"
    #include "resource.h"
    #include "irrlicht.h"
    
    
    using namespace irr;
    
    using namespace core;
    using namespace scene;
    using namespace video;
    using namespace io;
    using namespace gui;
    
    #pragma comment(lib, "Irrlicht.lib") //linking to the irr library
    
    
    int main()
    {
    	IrrlichtDevice *device =
    		createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 16,
    		false, false, false, 0);
    	device->setWindowCaption(L"Another Hello World!!!");
    
    	IVideoDriver* driver = device->getVideoDriver();   //SET pntrs to these devices
    	ISceneManager* smgr = device->getSceneManager();   //   for convenience
    	IGUIEnvironment* guienv = device->getGUIEnvironment();
    
    	guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!",	 
    		rect<int>(10,10,200,22), true);
    
    
    	IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");  //load a Quake
    																	//	2 model and display it
    	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
    
    		//To make the mesh look a little bit nicer, change it material 
    		 //  a little bit: disable lighting because we do not have a 
    		  // dynamic light in here and the mesh would be totally black 
    		  // Then set the frame loop so that the animation is looped 
    	
    	if (node){	
    		node->setMaterialFlag(EMF_LIGHTING, false);
    		node->setFrameLoop(0, 310);	
    		node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
    	}
    
    	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); //place the camera
    
    	while(device->run()){
    		driver->beginScene(true, true, SColor(255,100,101,140));
    		smgr->drawAll();
    		guienv->drawAll();
    		driver->endScene();
    	}
    
    	device->drop(); return 0;
    }

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    Is that the C# language? If so, you'd be better posting it on that board. Doesnt look like C++ or C to me
    Double Helix STL

  3. #3
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    Yes, VS 6.0 C++

  4. #4
    MFC killed my cat! manutd's Avatar
    Join Date
    Sep 2006
    Location
    Boston, Massachusetts
    Posts
    870
    I think its the dreaded....ugly C++!!
    Silence is better than unmeaning words.
    - Pythagoras
    My blog

  5. #5
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Quote Originally Posted by ititrx
    Compiling my first tutoriol/program, goes fine. Building gives this error:

    Linking...
    LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    Debug/helwld.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.
    Creating browse info file...

    helwld.exe - 2 error(s), 0 warning(s)

    I am new to C++ but have followed the directions on the tutorial, whcih says: to set the options>idirectories>include "\include directory of the Irrlicht Engine ", and to clcik libraries and put in the library path for VS studio in for the same machine above.s After researching I also Ihave put the Irrlicht.lib in the project settings link list as well.

    This is an xp running VS 6.0 C++

    I dont know what else to add...

    [B]OH ohB]the tutorial said if you get the first error then you have done the options/directories include wrong, but I have checked it several times....

    I have searched the msdn for info on the #pragmatic statement too, and all looks acurater there...

    Thanks for any help
    iti

    Code:
      
     // helwld.cpp : Defines the entry point for the application.
    //
    
    #include "stdafx.h"
    #include "resource.h"
    #include "irrlicht.h"
    
    
    using namespace irr;
    
    using namespace core;
    using namespace scene;
    using namespace video;
    using namespace io;
    using namespace gui;
    
    #pragma comment(lib, "Irrlicht.lib") //linking to the irr library
    
    
    int main()
    {
    	IrrlichtDevice *device =
    		createDevice(EDT_SOFTWARE, dimension2d<s32>(512, 384), 16,
    		false, false, false, 0);
    	device->setWindowCaption(L"Another Hello World!!!");
    
    	IVideoDriver* driver = device->getVideoDriver();   //SET pntrs to these devices
    	ISceneManager* smgr = device->getSceneManager();   //   for convenience
    	IGUIEnvironment* guienv = device->getGUIEnvironment();
    
    	guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!",	 
    		rect<int>(10,10,200,22), true);
    
    
    	IAnimatedMesh* mesh = smgr->getMesh("../../media/sydney.md2");  //load a Quake
    																	//	2 model and display it
    	IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
    
    		//To make the mesh look a little bit nicer, change it material 
    		 //  a little bit: disable lighting because we do not have a 
    		  // dynamic light in here and the mesh would be totally black 
    		  // Then set the frame loop so that the animation is looped 
    	
    	if (node){	
    		node->setMaterialFlag(EMF_LIGHTING, false);
    		node->setFrameLoop(0, 310);	
    		node->setMaterialTexture( 0, driver->getTexture("../../media/sydney.bmp") );
    	}
    
    	smgr->addCameraSceneNode(0, vector3df(0,30,-40), vector3df(0,5,0)); //place the camera
    
    	while(device->run()){
    		driver->beginScene(true, true, SColor(255,100,101,140));
    		smgr->drawAll();
    		guienv->drawAll();
    		driver->endScene();
    	}
    
    	device->drop(); return 0;
    }
    For a starter, what's with the "L" in the line below:

    Code:
    guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!",	 
    		rect<int>(10,10,200,22), true);
    And maybe for the linking error, maybe you've created a new Windows project but you used "int main()" not the WinMain(...).

  6. #6
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,401
    Quote Originally Posted by g4j31a5
    For a starter, what's with the "L" in the line below:
    Code:
    guienv->addStaticText(L"Hello World! This is the Irrlicht Software engine!",	 
    		rect<int>(10,10,200,22), true);
    Isn't that how you say that a string literal is made up of 2-byte characters instead of 1-byte characters? That looks hauntingly familiar from internationalization changes I made a while back, but it's been...a while.
    Quote Originally Posted by g4j31a5
    And maybe for the linking error, maybe you've created a new Windows project but you used "int main()" not the WinMain(...).
    Aye, dead on. If this is a Windows app, you need a WinMain. If it's supposed to be a console app, your project settings are wrong.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  7. #7
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    Note that there is a 'L' in front of the string: the Irrlicht Engine uses wide character strings when displaying text.

  8. #8
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    What???

    Aye, dead on. If this is a Windows app, you need a WinMain. If it's supposed to be a console app, your project settings are wrong.

  9. #9
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    This is the url for the tutorial:
    http://irrlicht.sourceforge.net/tut001.html

    I added the WinMain and still get the same two errors.

    Thanks much for helping.

  10. #10
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Well the best way is: Start a new project. Choose console (not windows) application. Copy-paste the tutorial to the main function.

  11. #11
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    Are you still there? what is the difference between console and windows?

    Thanks, I just didnt understand your question.... I have never coded in C++ before this was my first program, and I havent done any coding in anything but html and a little java in several years. But its time to retrain so I can build some games......smaile

  12. #12
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    A GUI looks like your browser.
    A console may look like this.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  13. #13
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    oh, yes, I understand. I didnt know C++ had a console to write code in. Will do, thanks.

  14. #14
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    Ok, did that and got the same error. So I guess thats not it either.

    Too bad, Ive got 4 more coded, but since they use the same setup they wont work either.

  15. #15
    Registered User
    Join Date
    Nov 2006
    Posts
    19
    IVE GOT IT! As I thought it was something simple, no .dll in exe folder. Oh well, thats what starting at the beggining means. At least there is an answer here for someone else.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 03:07 AM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  3. Including lib in a lib
    By bibiteinfo in forum C++ Programming
    Replies: 0
    Last Post: 02-07-2006, 02:28 PM
  4. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM
  5. debug to release modes
    By DavidP in forum Game Programming
    Replies: 5
    Last Post: 03-20-2003, 03:01 PM