A little problem with the Hello World tutorial

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Rhezz

A little problem with the Hello World tutorial

Post by Rhezz »

Hi,
Im new to C++ and to Irrlicht engine. Ive been working on the Hello World tutorial today. I wrote all the code. Im guessing this isnt a problem with my code and some setting that I having to change in Visual C++ (version 6.0). Here is the error message I get when I try to compile

Code: Select all

--------------------Configuration: HelloWorld - Win32 Debug--------------------
Linking...
LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
Debug/HelloWorld.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

HelloWorld.exe - 2 error(s), 0 warning(s)
I checked the links in the options, the folder of the LIBCD.lib file was there. Can someone please help out a newbie :)
DanyATK
Posts: 32
Joined: Mon Mar 22, 2004 8:40 pm
Location: Italy
Contact:

Post by DanyATK »

Simply open the project file "Hello World.dsp" and compile it.

If u want to rewrote the code, from menu file, select New->Win32 Console Application->An Empty Project and add a new cpp source. :wink:
The best italian GM related site
www.gamemaker.it
Guest

Post by Guest »

I still get the error. It compiles fine (sorry bout the first post saying it didnt compile), its when I try to build the exe I get that message. Ive tried making a new empty project and then adding the cpp file in..same thing. Sorry for being such a pain.

Thanks :) Any advice is appreciated.
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

If you're starting a new project then you must modify some of the settings.
in VC++ select your project on the left (below workspace), right click on it and select settings. Go to the 3rd tab and in "preprocessor definitions" paste this:

WIN32,NDEBUG,_CONSOLE,_MBCS

the on the same tab, on "project options", paste this:

/nologo /ML /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"Release/SpecialFX.pch" /YX /Fo"Release/" /Fd"Release/" /FD /c

ok, then go to the 4th tab, and in "object/library modules" paste this:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

finally, in the same tab, in "project options" paste this:

kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /incremental:no /pdb:"Release/display3d.pdb" /machine:I386 /out:"Release/display3d.exe"

where the .exe is the name of your file.

I had the same problem when starting a project from scratch , so I had to copy other project's options.

remember also to set up your "include" and "lib2 paths in the options.

cheers!
Image
Mindl
Posts: 16
Joined: Wed Jun 30, 2004 1:42 am

Post by Mindl »

You can also try adding the /nodefaultlib:"LIBCD" to the project options. Also if i remember right you need to make sure you have your project is selected as Win32 app if you try to call WinMain. Calling winmain witht he console project will give this error if my memory serves me, so if you are calling WinMain in a console project just change it to int main(). Hope this helps.

-Mindl
Rhezz

Hmm well its almost working :)

Post by Rhezz »

Thanks a lot for that guys :) Really valuable info to me. It all compiles and builds now. Now it cant find the Irrlicht.dll file. Ive checked in the options 10 times...Ive definetley put the correct path in. Is there another snag in this?

Sorry for my extreme lack of knowledge, Im trying my best to learn.
Endar
Posts: 145
Joined: Mon Jun 14, 2004 7:59 am

Post by Endar »

To find the irrlicht.dll file, you need to put the file in the same directory as the exe file, or becuase you're using VC++ the exe file is in the Debug folder, put the dll file in the one above that.

So, if you have "c:\helloWorld" and the exe file gets compiled into "c:\helloWorld\Debug" then the dll goes into "c:\helloWorld", but this is only if you are running from within VC++. If you are just using Explorer and double clicking on the exe, then the dll needs to be in the same directory as the exe.
"The reputation of a thousand years may be determined by the conduct of one hour."
-Japanese Proverb
Rhezz

Post by Rhezz »

Woo hoo it worked :) Thanks a lot for that. lol at first I tried to copy the .lib file and then realised I needed the .dll file. :wink: Well I learn well from mistakes and thats really what these Hello World apps are for. Thanks for the help guys :) I really appreciate it.
Post Reply