Linker Error: undefined references

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
FSME
Posts: 4
Joined: Tue Dec 19, 2006 1:21 pm

Linker Error: undefined references

Post by FSME »

Right, so I'm trying my luck with the first tutorial and after successfully managing to sort out my linker problem number 1) (which turned out to be the same as his) I'm now stuck with problem number 2) and so far couldn't find anything on the forum. I did find quite a lot on google but most of the solutions didn't seem to apply here (or I'm just too bloody nooby to understand the connection, which is more likely :roll:)

Anyway, this is the linker error I get:

--------------------Configuration: stuff - Debug--------------------
Linking...
C:\mingw\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\mingw32\bin\ld.exe: warning: cannot find entry symbol _mainCRTStartup; defaulting to 00401000
C:\mingw\Templates\stuff\Debug\hw.o: In function `main':
C:\mingw\Templates\stuff\hw.cpp:44: undefined reference to `_alloca'
C:\mingw\Templates\stuff\hw.cpp:44: undefined reference to `__main'
collect2: ld returned 1 exit status

stuff.exe - 3 error(s), 0 warning(s)
---

These are my lines 43-45 (loads of comments before that):

43: int main()
44: {
45: IrrlichtDevice *device = createDevice();

Weirdly enough, if I try different parameters in createDevice() it gives me a linker error for line 28(?) in position2d.h which holds this:
position2d(T x, T y) : X(x), Y(y) {};


I somehow got the feeling that there is still something wrong with my libraries but I can't quite put my finger on it...

Any ideas?
jimowns
Posts: 62
Joined: Thu Sep 28, 2006 5:28 pm
Location: X-Gamers

Post by jimowns »

try to add this .

Code: Select all

int main()
{ 
	
	IrrlichtDevice *device =
    device = irr::createDevice(EDT_DIRECT3D9, core::dimension2d<s32>(1280, 1024), 32, true);
FSME
Posts: 4
Joined: Tue Dec 19, 2006 1:21 pm

Post by FSME »

Thanks for the idea, but it didn't change anything :(

Forgot to mention: I'm using minGW and gcc.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Then use the correct library (from lib/Win32-gcc and bin/Win32-gcc).
FSME
Posts: 4
Joined: Tue Dec 19, 2006 1:21 pm

Post by FSME »

I'm already using those, at least the lib ones. I found out that for some reason the "ignore default startup files" and "ignore all default libraries" options where checked which caused the linker issue.

After it built ok, it wouldn't run and told me it's missing the irrlicht.dll (as you mentioned with the bin). Any idea how to tell the program where to look for the dll?

I got around that problem by copying the dll in the exe's folder, so now at least it's running. Yeay! :D

Thanks for the help everyone.
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah just sticking the .dll in the folder with the .exe is the most common and probably best way to do it :)
Image Image Image
Post Reply