Page 1 of 1

Linker Error: undefined references

Posted: Wed Dec 20, 2006 12:37 pm
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?

Posted: Wed Dec 20, 2006 1:37 pm
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);

Posted: Wed Dec 20, 2006 10:22 pm
by FSME
Thanks for the idea, but it didn't change anything :(

Forgot to mention: I'm using minGW and gcc.

Posted: Wed Dec 20, 2006 10:39 pm
by hybrid
Then use the correct library (from lib/Win32-gcc and bin/Win32-gcc).

Posted: Thu Dec 21, 2006 8:51 pm
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.

Posted: Thu Dec 21, 2006 9:18 pm
by JP
Yeah just sticking the .dll in the folder with the .exe is the most common and probably best way to do it :)