building hello world... [solved]

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
noals
Posts: 70
Joined: Sun May 18, 2008 2:59 pm

building hello world... [solved]

Post by noals »

hi,

i followed the video tutorial to compile Irrlicht so my .dll is ok but i cant compile my helloworld.

i use code::blocks 8.02
dx8 sdk
MS platform SDK
MSVC toolkit 2003
anyway, all the files in there...


here is my "helloworld" code (kinda the same as the official tuto)

Code: Select all

#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")

int main()
{

/* rendu*/

    IrrlichtDevice *device =
        createDevice(EDT_SOFTWARE, dimension2d<s32>(512,384), 16,
        false, false, false, 0);
    device->setWindowCaption(L"Hello World!");

    IVideoDriver* driver = device->getVideoDriver();
    ISceneManager* smgr = device->getSceneManager();
    IGUIEnvironment* guienv = device->getGUIEnvironment();

    guienv->addStaticText(L"Titre du GUI",
            rect<int>(10,10,200,22), true);

/* model */

    IAnimatedMesh* mesh = smgr->getMesh("C:/programmation/projets/helloworld/sydney.md2");
    IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode( mesh );
    if (node)
    {
        node->setMaterialFlag(EMF_LIGHTING, false);
        node->setFrameLoop(0, 310);
        node->setMaterialTexture(0, driver->getTexture("C:/programmation/projets/helloworld/sydney.bmp"));
    }

/* caméra */

    smgr->addCameraSceneNode(0, vector3df(0, 30, -40), vector3df(0, 5, 0));

/* loop */

while(device->run())
{
    driver->beginScene(true, true, SColor(255, 100, 101, 140));
    smgr->drawAll();
    guienv->drawAll();
    driver->endScene();
}

device->drop();
return 0;
}

and here the error :
||=== helloworld, Release ===|
LIBC.lib(wincrt0.obj)||error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup|
bin\Release\helloworld.exe||fatal error LNK1120: 1 unresolved externals|
||=== Build finished: 2 errors, 0 warnings ===|
the /NODEFAULTLIB:libci.lib dont work here
its the same if i link or not the toolkit libraries (because libc.lib is in it)

i dont get it.

i was glad to find at least an engine that seem more simple or understandable for a noob like me but i get stuck even before being able to test it...
how can i compile my helloworld please ?


thx
cya.
Last edited by noals on Sun May 18, 2008 4:38 pm, edited 1 time in total.
radical-dev
Posts: 45
Joined: Thu Apr 24, 2008 7:54 pm
Location: Wickede, Germany

Post by radical-dev »

hi noals!

i don't know code::blocks, but your example requests the entry point at WinMain(), not main().

At VC it's the Linker-Option subsystem. U need to set your Linkersettings to a console-application.

Probably someone else knows code::blocks ;)

Greetings
noals
Posts: 70
Joined: Sun May 18, 2008 2:59 pm

Post by noals »

thx for answered
here is what i have :

Image

so when you compile Irrlicht.ddl, you need to add the "/NODEFAULTLIB:libci.lib" option in "Other linker options" and that fix it so maybe i need to add another option like that to fix this problem but im just a noob so im stuck.

or maybe i need to add some .ddl from the toolkit.
dunno, 2 days i try randoms things but none of them work ^^;


thx
cya



edit : its ok, i found it !
thx, ur reply helped me a lot ^^

Image

at least i will can try it out !!

thx again ! :D

cya
pelonzudo
Posts: 20
Joined: Wed May 07, 2008 11:14 am

Post by pelonzudo »

I had a similar problem. But I have 2 building setings, one with the cosole and other without it. So I addes that lines to C::B at Linker Settings -> Other linking options:

Code: Select all

/subsystem:windows
/ENTRY:mainCRTStartup
That solves the linking error when i said is a GUI application to C::B
noals
Posts: 70
Joined: Sun May 18, 2008 2:59 pm

Post by noals »

thx, maybe i will need it someday.

its kinda the first time i use C::B so i dont really know about it.
in VC if i remember well, you choose this setting when you create your project, in C::B, you just open a new Irrlicht project so i didnt pay attention to that and since im just a noob in programming... ^^

anyway, thx for help again.
im able to compile now, next step for me is to do my own map.

peace
cya
Post Reply