Linux error on compile

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.
Post Reply
guardian1372
Posts: 5
Joined: Tue Nov 27, 2007 8:23 pm

Linux error on compile

Post by guardian1372 »

Hi all..

I'm using UBUNTU, and Kdevelop.

When I compile an app using the irrlicht headers (ie the helloworld app) I get this error:

Code: Select all

irrlichttest.cpp:113: undefined reference to `irr::createDevice(irr::video::E_DRIVER_TYPE, irr::core::dimension2d<int> const&, unsigned int, bool, bool, bool, irr::IEventReceiver*, char const*)'
I have tried in another IDE and also manually compiling, I get the same error on all.


I have tried just going into the helloworld directory, and doing a make, I get this output:

Code: Select all

Makefile:29: Building...
g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L/usr/X11R6/lib -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11
you will notice no errors or warnings there, but there is no binary created.
guardian1372
Posts: 5
Joined: Tue Nov 27, 2007 8:23 pm

fixed it...

Post by guardian1372 »

had to heavily re-write the makefile.
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

No, the makefiles work out-of-the-box. There are some drawbacks with changing paths, but the new Makefile for example 01 has proper variables for this purpose.
But project files are always relative to some directory, otherwise they would not work on all machines. And this means that you will always have to adapt some things when changing project locations.
Sagocr
Posts: 3
Joined: Sat May 28, 2011 5:46 am

Re: Linux error on compile

Post by Sagocr »

I'm the same error : main.cpp:(.text+0x70): undefined reference to `createDevice'
compilig de Hello world example in Kdevelop
guardian1372 wrote: you will notice no errors or warnings there, but there is no binary created.
note that: g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L/usr/X11R6/lib -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11

the "-o ../../bin/Linux/01.HelloWorld" define the output directory of compilation, please, revise your "/bin/Linux" directory in your Irlicht tree directory.

now I have'nt solution for the undefined reference problem, see http://irrlicht.sourceforge.net/phpBB2/ ... t=kdevelop
Sagocr
Posts: 3
Joined: Sat May 28, 2011 5:46 am

Re: Linux error on compile

Post by Sagocr »

Sagocr wrote:I'm the same error : main.cpp:(.text+0x70): undefined reference to `createDevice'
compilig de Hello world example in Kdevelop
guardian1372 wrote: you will notice no errors or warnings there, but there is no binary created.
note that: g++ -I../../include -I/usr/X11R6/include -O3 -ffast-math main.cpp -o ../../bin/Linux/01.HelloWorld -L/usr/X11R6/lib -L../../lib/Linux -lIrrlicht -lGL -lGLU -lXxf86vm -lXext -lX11

the "-o ../../bin/Linux/01.HelloWorld" define the output directory of compilation, please, revise your "/bin/Linux" directory in your Irlicht tree directory.

now I have'nt solution for the undefined reference problem, see http://irrlicht.sourceforge.net/phpBB2/ ... t=kdevelop
SOLUTION :D
The complier configuration in Kdevelop 4 was'nt a menu iteml, the compiler configuration is in CMakeLists.txt file (in your source directory)
Replace the content old:

Code: Select all

project(testirrlicht)
add_executable(testirrlicht main.cpp)
by:

Code: Select all

#cmake ver req
cmake_minimum_required(VERSION 2.6)

set(project_name testirrlicht)

#project name
project(${project_name})

#so that it talks to us
set(CMAKE_VERBOSE_MAKEFILE ON)

#dependencies
include_directories(/home/luysa/projects/irrlicht/include/)
include_directories(/usr/X11R6/include/)
link_directories(//home/luysa/projects/irrlicht/lib/Linux/)
link_directories(/usr/X11R6/lib64/)

#header files source
include_directories("${CMAKE_SOURCE_DIR}")
link_directories("${CMAKE_SOURCE_DIR}")

#setting the libraries that will be compiled
#set(${project_name}_files here_come_the_libraries_you_want_to_compile)

#setting the external libraries that will be needed
set(${project_name}_external_libs  Irrlicht  GL Xxf86vm Xext X11)

#adding the project's own libraries
#foreach(lib ${${project_name}_files})
#  add_library(${lib} SHARED ${lib}.cpp)
#endforeach()

#adding the project's exe
add_executable(${project_name} main.cpp)

#adding the project's own headers
#foreach(lib ${${project_name}_files})
#  add_dependencies(${project_name} ${lib})
#endforeach()

#linking in libraries from other sources
foreach(lib ${${project_name}_external_libs})
  target_link_libraries(${project_name} ${lib})
endforeach()
That's works in my system
----
I'm Happy :D I'm start with irlich engine
Sorry, I'm very poor english :shock:
Post Reply