0

I'm trying to compile the very first code given by Irrlicht library website.

As said in the title, I get an undefined reference. I'm using 8.2 netbeans IDE.

This is what I've done so far : Installed Irrlicht library from the Linux repository (I'm using Ubuntu 18.04). Using these command lines : sudo apt-get install libirrlicht1.8 libirrlicht1.8-dbg libirrlicht-dev libirrlicht-doc

In the "project properties", I've added the include directory, as well as the include headers (e.g all the files contained in /usr/include/irrlicht. Also, in the "Additional Options" (the linker part, I guess ?) , I've seen online that I should add -lIrrlicht command line, and it still got me the undefined reference.

I've tried also the following command line : -L /usr/include/irrlicht -lIrrlicht, still got me the undefined reference.

I know that the compiler finds the library, as it does not make a compilation error saying that it doesn't know "irrlicht.h", so the problem is coming from the linker. What command line does the linker expects ?

Note : I'm not able to make any update. Talking about irrlicht, it seems that I have 363 packages outdated. Could the problem be from there ?

Edit : Here is the minimum code, as requested. There is no point showing it, as the error comes from the linker command line :

#include <cstdlib>
#include <iostream>
#include <irrlicht.h>

using namespace std;
using namespace irr;
using namespace core;

int main(int argc, char** argv) {

    IrrlichtDevice *device=createDevice(video::EDT_SOFTWARE,dimension2d<u32>(640,480),16,false,false,false,0);
return 0;
}
TheViper
  • 39
  • 4
  • 1
    Please include a [mcve] in the question – 463035818_is_not_an_ai Feb 17 '20 at 15:41
  • There is no point giving a piece of code. It is the one given on Irrlicht website, the "hello world" program. No more, no less. – TheViper Feb 17 '20 at 23:06
  • If the problem is not with the source code, you should copy the exact error message, and, if possible, some build file snippets that you believe lead to the error. Then, consider how useful an answer would be in general to other people searching the site. And also, "it doesn't know "irrlicht.h" does not look like a linker error to me. – kkm inactive - support strike Feb 18 '20 at 00:56

1 Answers1

1

I had a similar problem with another library. I fixed it by changing the path in the linker?

according to https://de.wikibooks.org/wiki/Irrlicht_-_from_Noob_to_Pro:_C%2B%2B_f%C3%BCr_Irrlicht_einrichten

you have to link lIrrlicht like:

LIBS += -L/.../Irrlicht/irrlicht-1.7.1/lib/Linux
LIBS += -lIrrlicht 

instead of -L /usr/include/irrlicht -lIrrlicht (for unix).

Did you try that?

s.blnc
  • 76
  • 6
  • I'm using NetBeans , not VisualStudio, and it seems that what you've found is applying to VisualStudio only. – TheViper Feb 17 '20 at 23:29