Linker & BuildError Compiling "Demo" (Dev-Cpp)

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.
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Linker & BuildError Compiling "Demo" (Dev-Cpp)

Post by C2L-Studios »

When I try to compile Demo now... This is what I get.... (Everything else in example compiles correctly now...)

Code: Select all

  [Linker error] undefined reference to `CMainMenu::CMainMenu()' 
  [Linker error] undefined reference to `CMainMenu::run(bool&, bool&, bool&, bool&, bool&, irr::video::E_DRIVER_TYPE&)' 
  [Linker error] undefined reference to `CDemo::CDemo(bool, bool, bool, bool, bool, irr::video::E_DRIVER_TYPE)' 
  [Linker error] undefined reference to `CDemo::run()' 
  [Linker error] undefined reference to `CDemo::~CDemo()' 
  [Linker error] undefined reference to `CDemo::~CDemo()' 
  [Linker error] undefined reference to `vtable for CMainMenu' 
  ld returned 1 exit status 
 C:\Documents and Settings\Owner\Desktop\Dennis\irrlicht-0.8\examples\Demo\Makefile.win [Build Error]  [example.exe] Error 1 
Why?

Code: Select all

Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Owner\Desktop\Dennis\irrlicht-0.8\examples\Demo\Makefile.win"
Executing  make...
make.exe -f "C:\Documents and Settings\Owner\Desktop\Dennis\irrlicht-0.8\examples\Demo\Makefile.win" all
g++.exe main.o  -o "example.exe" -L"lib" -mwindows ../../lib/DevCpp/libIrrlicht.a ../../lib/DevCpp/libjpeg.a ../../lib/DevCpp/libz.a  

main.o(.text+0x70):main.cpp: undefined reference to `CMainMenu::CMainMenu()'
main.o(.text+0xaf):main.cpp: undefined reference to `CMainMenu::run(bool&, bool&, bool&, bool&, bool&, irr::video::E_DRIVER_TYPE&)'
main.o(.text+0xf4):main.cpp: undefined reference to `CDemo::CDemo(bool, bool, bool, bool, bool, irr::video::E_DRIVER_TYPE)'
main.o(.text+0x10c):main.cpp: undefined reference to `CDemo::run()'
main.o(.text+0x14c):main.cpp: undefined reference to `CDemo::~CDemo()'
main.o(.text+0x172):main.cpp: undefined reference to `CDemo::~CDemo()'
main.o(.text$_ZN9CMainMenuD1Ev[CMainMenu::~CMainMenu()]+0xb):main.cpp: undefined reference to `vtable for CMainMenu'
collect2: ld returned 1 exit status

make.exe: *** [example.exe] Error 1

Execution terminated
that is the actual compile log with a total of 8 errors...

Can someone please help?
Last edited by C2L-Studios on Thu Mar 10, 2005 2:27 am, edited 3 times in total.
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

Any help is appreciated...
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

Does anyone know? I am using Dev-Cpp 4.9.9.2

C2L-Studios
MikeR
Posts: 767
Joined: Sun Dec 26, 2004 4:03 pm
Location: Northern California USA
Contact:

Post by MikeR »

Don't quote me, but it looks like it can't find CMainMenu.h and CDemo.h
I haven't tried to compile that one yet.
If it exists in the real world, it can be created in 3d

Sys specs:
AMD 3700+ 64 processor
1.0 gb ram
e-Geforce 6600 graphics 256 mb onboard ram
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

ok, thanks... I am going to see what I can do... Also, please if you figure it out, come back with some help! ;)

-Thanks

C2L-Studios
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

Anyone else?
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

I just tried this and had no problem at all using a freshly installed Dev C++ 4.9.9.2 and Irrlicht 0.8.

Demo doesn't contain a Dev C++ project file, so I created one as follows:
  • New C++ Windows application
  • Add files from examples\Demo folder: CDemo.cpp, CMainMenu.cpp, main.cpp
  • In Project Options:Directories, add include directory irrlicht-0.8\include
  • In Project Options:Parameters, "Add Library or Object" irrlicht-0.8\lib\libirrlicht.a
(I'm giving incomplete paths. You should change "examples\Demo" to "C:\irrlicht-0.8\examples\Demo", and such like that)

Additionally, I don't have the audiere library set up, so I removed line 12 of CDemo.h (which read "#define USE_AUDIERE").

After this, I fired it up and everything just worked. In OpenGL, anyway. I don't have my Dev C++ and Irrlicht set up to compile DirectX. :)
Last edited by Murphy on Fri Mar 11, 2005 2:50 am, edited 1 time in total.
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

ok let me try.... (BTW, I did create a project file though... But only added main.cpp, but I do not think that would have affected much... maybe it did, I am used to compiling actual programs/software....)

*tries*

Problem fixed! Thanks so much! I guess it was the AUDIERE screwing it up... I do have another question for you then... 2 actually...

First, how do I get music on the game then, because if I am not mistaken, you need the Audiere LIBs to do so... (I have downloaded the ZIP file, but I am not sure that is enough)

Second, how do I compile for DirectX?

-Well thanks so much for your help

C2L-Studios
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

C2L-Studios wrote:BTW, I did create a project file though... But only added main.cpp, but I do not think that would have affected much...
It would have affected it much. That was your main problem.
First, how do I get music on the game then, because if I am not mistaken, you need the Audiere LIBs to do so... (I have downloaded the ZIP file, but I am not sure that is enough)
I'm a Visual Studio user and not a Dev C++ user, but this only took a minute (and a Google search for Audiere DevCpp) to figure out.
  • Get Audiere DevPak from http://www.g-productions.net/page.php?id=8
  • Install DevPack
  • In Project Options:Parameters, "Add Library or Object" Dev-Cpp/lib/audiere.lib
  • Re-add the "#define USE_AUDIERE" in CDemo.h
  • Copy Dev-Cpp/dll/audiere.dll into the folder with your EXE.
When Audiere is enabled in the source, you get a compile time error on I think line 67 in CDemo.cpp. My guess is that some plain C headers are getting pulled in, so swprintf() isn't being overloaded and you end up with the single non-standard-conformant version. To fix this, simply change "swprintf" to "_snwprintf".
Second, how do I compile for DirectX?
I'll leave that one to the Dev C++ users! This has been much discussed and answered. Here are some posts on the subject (there are probably more).
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=5813
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=4497
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=1700
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

Wow, thanks a lot, you were and are a big help in all of this, thanks.

Although, I still cannot get the game itself to load after that, only compile... If you could help me with this too, that would be great! But oh well, you have helped me so much, thanks!

C2L-Studios
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

So it loaded before, but now it will not?

What does it do? Crash before you ever see anything?

Try commenting out or removing the "#define USE_AUDIERE" line, and recompile again and see how it goes. Also, try "cleaning" your project or forcing a rebuild all.
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

ok, I will try both, but no it was doing this before too... (Without Audiere, that might have been because of the DX9 thing though)

It sometimes will give me an hourglass next to my mouse, then not do anything and not even open...

*EDIT* Same thing.... I tried both... seperatly and together... Also, everytime I compile it I get this "foo.zip" file and it gives me a "foo.DOC" file which only says
Hello! Hello!
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

Also, in Project Options:General, change the project type to "Win32 Console".

You may need to run the program from the commandline (a "DOS box") for this to be helpful.

Irrlicht should send some debugging info to the console window. Please tell us what it says.
Murphy
Posts: 290
Joined: Mon Dec 13, 2004 12:06 am
Location: United States
Contact:

Post by Murphy »

C2L-Studios wrote:*EDIT* Same thing.... I tried both... seperatly and together... Also, everytime I compile it I get this "foo.zip" file and it gives me a "foo.DOC" file which only says
Hello! Hello!
That is bizarre. It sounds like maybe a virus?
C2L-Studios
Posts: 16
Joined: Tue Mar 08, 2005 11:43 pm

Post by C2L-Studios »

no, I know it is not that.... I would have other signs... and I have unzipped the Irrlicht.zip to rebuild everything numerous times... I can still build the other examples... And now use DirectX 9.0c or 8.0... (For example 02.Quake3dMap works in DIRX after recompiling still...)

C2L-Studios

*EDIT* won't work from a DOS Box either...

Quote from DOS Box
uncompress<>:Hello! Hello!
gzspread<>:Hello! Hello!
gzgets<>:Hello!
inflate<>:Hello!
large_inflate<>:OK
after inflatesync<>:hello, Hello!
inflate with dictionary:hello, Hello!
Last edited by C2L-Studios on Fri Mar 11, 2005 12:57 pm, edited 1 time in total.
Post Reply