Mkay, so I just started using Irrlicht. I downloaded and installed and followed directions as best i could.
Then I go to the .chm document copy the little example there.
i go to the Terminal (i'm on a Ubuntu machine) and type:
g++ -c example.cpp
g++ example.o -o example
the second command gives me the following error:
example.o: In function `main':
example.cpp:(.text+0x6c): undefined reference to `irr::createDevice(irr::video::E_DRIVER_TYPE, irr::core::dimension2d<int> const&, unsigned int, bool, bool, bool, irr::IEventReceiver*, char const*)'
collect2: ld returned 1 exit status
This is also my first dive into not using an IDE (just vi and g++) so any help is appreciated. Thanks alot, and sorry if I need to post more info.
Undefined Reference to createDevice from example
It depends on what platform you are on. Since you are using gcc, you want to link to the library in the lib/Win32-gcc or the Linux directory. You need to pass the appropriate flags to your linker to tell it where to find the library and what library to look for.
In your example, pasted above, you are compiling on one step and then linking on the next. You can pass additional command line flags to the linker. You use the -L flag to specify the name of the directory to look for, and you would use the -l [that is an ell or lowercase L] to specify the name of the library to link.
Assuming that you extracted the distribution to /tmp/irrlicht/ and you are on Linux, you could compile and link your entire example in one line, like this...
Travis
Code: Select all
g++ -c example.cpp
g++ example.o -o example
Assuming that you extracted the distribution to /tmp/irrlicht/ and you are on Linux, you could compile and link your entire example in one line, like this...
Code: Select all
g++ example.cpp -o example -L/tmp/irrlicht/lib/Linux/ -lirrlicht
thanks a ton! I had no idea i could do that! (just started using linux a few months ago)
well i don't think i'm getting that error anymore... instead it's another
several several lines that i won't bother to copy but the last 20-30 of which are undefined references in COpenGLTexture.cpp
sigh. Perhaps after a night's rest i can attack the problem better. i fiddle with it in the morning and update this post.
well i don't think i'm getting that error anymore... instead it's another
several several lines that i won't bother to copy but the last 20-30 of which are undefined references in COpenGLTexture.cpp
sigh. Perhaps after a night's rest i can attack the problem better. i fiddle with it in the morning and update this post.
You may need to link to other libraries like the opengl library. I advise that you have a look at the makefiles that are provided with the example programs. If you are in the directory with the example source file you should just have to type 'make' and it would compile and link the example for you.
Travis
Travis