Page 1 of 1

demo problem compiling in Linux with codeblocks....

Posted: Sat Aug 18, 2007 1:15 am
by budword
I'm trying to get the demo from examples to run on Kubuntu, coding with codeblocks. I opened up the source with codeblocks, when I compiled, I got some errors about irrklang, I downloaded irrklang, (found no linux binarys though), and added them to the search path, and compiled again, this time it said, "no errors", but I can't find the result, and it doesn't start on it's own when I use "build and run" from the drop down menu. (The hello world tutorial does, so I have the basics set up correctly at least.)

The only clues I have to go by aren't even error messeges, just some messeges from the build log. Here they are, I have no idea what they mean.

Linking console executable: ../../bin/Linux/Demo
irrlicht/examples/Demo/CDemo.o: No such file or directory
irrlicht/examples/Demo/CMainMenu.o: No such file or directory
irrlicht/examples/Demo/resscript.res: No such file or directory

No executable shows up there though, and codeblocks says everything compiled without errors, so I have no idea what I'm doing wrong.

Can anyone point me in the right direction ?

Thanks much...

David

P.S. When I got the hello world tutorial to run I had to change the relative paths to the model to an absolute path, is there some chance that something similar is going on here ?

Posted: Sat Aug 18, 2007 8:15 am
by hybrid
It sounds as if it does not work at all. You will laso need a library under Linux for irrKlang, set up proper path for linking etc. But if no .o file is created (or found) you won't get anything.

Posted: Sat Aug 18, 2007 8:38 am
by Wyszo
The simplest solution would be to just use make instead of Code::Blocks.

Any make experts out there ?

Posted: Sat Aug 18, 2007 6:50 pm
by budword
I don't mind using the command line at all, but I don't know anything about make. Is there an option with make to identify the include folder of irrlicht ? And all the other lib's I have to define in the build options of codeblocks ? Or is that what a makefile is for ? Just for the demo project in codeblocks there are 3 folders with a million subfolders for sources, headers and "resources", whatever the hell I need those for. It's an awful lot for a novice to get his head around all at once.

Has anyone run across any good tutorials on building irrlicht projects via the command line ? I've googled about irrlicht for the last 2 weeks or so and I've never seen one. Even just a good read on using command line tools on a complex project would come in handy for a novice.

I prefer the console with the smaller projects I'm used to, if I make an error it's much easier to track down and fix, with an IDE I'm not sure if the problem is code or configuration, so I would love to just use the command line, but I don't really see how that's possible when you start working on a larger project.

Has anyone here had success with just using command line tools on a larger project ?

Thanks much for sharing your thoughts...

David

Posted: Sat Aug 18, 2007 8:33 pm
by Wyszo
I don't have time to write detailed answer, but here is what you need to do:

1. open terminal
2. enter the directory with irrlicht
3. enter directory "source/irrlicht"
4. run make under fakeroot (type: sudo make)

There should be no compiler or linker errors. You will find your compiled libirrlicht.a in /usr/local/lib directory (or /usr/local/lib/irrlicht - I don't really remember). That's exactly where gcc looks for library files. So now you just have to add -lirrlicht in your project to linker options under code::blocks. Simple.

Posted: Sat Aug 18, 2007 10:45 pm
by hybrid
Of course you will never run make as root, neither sudo nor su nor anyway else. The onyl time you might have to be root is with 'make install'.

Posted: Sat Aug 18, 2007 11:21 pm
by Wyszo
Of course hybrid is absolutely right. I was in hurry when I was writting previous post, sorry - my mistake :)

I've already done some of this....

Posted: Sat Aug 18, 2007 11:41 pm
by budword
I've already used codeblocks to build the hello world example, and solved a few minor bugs, so I know that part is working at least. I did copy the irrlicht.a to /usr/lobal/lib, but still came out with a bunch of errors, that I had before I defined the correct lib locations in codeblocks, so I don't believe gcc is finding irrlicht.a.

Ok, I guess that might be a little confusing. So, I tried to compile the demo from the command line, just using "make" from the demo directory. I got these errors.

g++ -O3 -ffast-math -I../../include -I/usr/X11R6/include -c -o CDemo.o CDemo.cpp
In file included from CDemo.cpp:4:
CDemo.h:21:91: error: irrKlang.h: No such file or directory
CDemo.h:65: error: ‘audio’ has not been declared
CDemo.h:65: error: ISO C++ forbids declaration of ‘ISoundEngine’ with no type
CDemo.h:65: error: expected ‘;’ before ‘*’ token
CDemo.h:66: error: ‘audio’ has not been declared
CDemo.h:66: error: ISO C++ forbids declaration of ‘ISoundSource’ with no type
CDemo.h:66: error: expected ‘;’ before ‘*’ token
CDemo.h:67: error: ‘audio’ has not been declared
CDemo.h:67: error: ISO C++ forbids declaration of ‘ISoundSource’ with no type
CDemo.h:67: error: expected ‘;’ before ‘*’ token
CDemo.cpp: In constructor ‘CDemo::CDemo(bool, bool, bool, bool, bool, irr::video::E_DRIVER_TYPE)’:
CDemo.cpp:14: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp: In destructor ‘virtual CDemo::~CDemo()’:
CDemo.cpp:28: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp: In member function ‘void CDemo::run()’:
CDemo.cpp:74: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp: In member function ‘void CDemo::shoot()’:
CDemo.cpp:670: error: ‘ballSound’ was not declared in this scope
CDemo.cpp:671: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp: In member function ‘void CDemo::createParticleImpacts()’:
CDemo.cpp:718: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp:720: error: ‘audio’ has not been declared
CDemo.cpp:720: error: ‘sound’ was not declared in this scope
CDemo.cpp:721: error: ‘impactSound’ was not declared in this scope
CDemo.cpp: In member function ‘void CDemo::startIrrKlang()’:
CDemo.cpp:748: error: ‘irrKlang’ was not declared in this scope
CDemo.cpp:748: error: ‘audio’ has not been declared
CDemo.cpp:755: error: ‘audio’ has not been declared
CDemo.cpp:755: error: ‘snd’ was not declared in this scope
CDemo.cpp:767: error: ‘ballSound’ was not declared in this scope
CDemo.cpp:768: error: ‘impactSound’ was not declared in this scope
make: *** [CDemo.o] Error 1

I think gcc can't find irrlicht or irrklang. Do you solve this by editing the makefile ? Or calling an option when invoking make ? Seems like an ide would simplify matters here, it seems to work a little better anyway. Once again, I have no idea what I'm doing wrong.

Thanks much for all your help, and taking the time to point me in the right direction. :)

David

Posted: Sun Aug 19, 2007 12:05 am
by Wyszo
First of all - read the output :) Everything is written there.
Second of all - find irrKlang.h, copy path to irrklang.h and add option -Iyour_path_to_irrKlang.h to during your compilation.

Oh, and if you haven't install irrKlang - better don't tell us about it :)
And one last thing - you have internet access - try to learn self-dependence.