Generate a make file from a Codeblocks project

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
ragnatic
Posts: 14
Joined: Sun Nov 22, 2009 5:11 am

Generate a make file from a Codeblocks project

Post by ragnatic »

I really don't know how to generate a makefile from a Codeblocks project so it can be executed in other SOs. Like programming in Arch Linux and running this code in Ubuntu. That's my particular case.

I've been searching and I found this http://irrlicht.sourceforge.net/forum/v ... ke#p256038 and the comment of bitplane is not very clear for me. Besides, there's irrBuild http://sourceforge.net/projects/irrbuild/ but I'm afraid to say that I don't know how it can help me.
ragnatic
Posts: 14
Joined: Sun Nov 22, 2009 5:11 am

Re: Generate a make file from a Codeblocks project

Post by ragnatic »

I'm getting some success with cmake but I'm having some problems

This is my folder

Code: Select all

 
Project 
    -CMakeLists.txt 
    -main.cpp
    -Irrlicht
        -include
        -source
        -bin/Linux
     -bin
        -CMakeLists.txt
        -actual binary file
These are my CMakeLists files. First the one in the project folder

Code: Select all

cmake_minimum_required(VERSION 2.6)
project(PROJECTUNO)
 
#There are lots of scripts with cmake
#for finding external libraries. 
#see /usr/local/share/cmake-2.6/Modules/Find*.cmake for more examples
find_package(OpenGL)
find_package(X11)
find_package(ZLIB)
 
set(CMAKE_CXX_FLAGS "-g -Wall")
add_subdirectory(bin)
 
 
And this in the bin folder

Code: Select all

include_directories(
  ${PROJECT_SOURCE_DIR}/Irrlicht/include
  ${PROJECT_SOURCE_DIR}/bin
  ${X11_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
  ${ZLIB_INCLUDE_DIR}
  ${OPENGL_INCLUDE_DIR}
)
link_directories(${PROJECT_BINARY_DIR}/Project)
 
add_executable(Project main.cpp
)
 
target_link_libraries(Project
  ${X11_LIBRARIES}
  ${GLUT_LIBRARIES}
  ${ZLIB_LIBRARIES}
  ${OPENGL_INCLUDE_DIR}
  ${PROJECT_SOURCE_DIR}/Irrlicht/lib/Linux/libIrrlicht.a
)
 
 
When I run cmake I get this warning

WARNING: Target "Project" requests linking to directory "/usr/include". Targets may link only to libraries. CMake is dropping the item.

and when I run make I get a bunch of errors like these

...
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:241: undefined reference to `glXGetProcAddressARB'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:468: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:472: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:477: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:484: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:488: undefined reference to `glGetIntegerv'
../../Irrlicht/lib/Linux/libIrrlicht.a(COpenGLExtensionHandler.o):/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:493: more undefined references to `glGetIntegerv' follow
../../Irrlicht/lib/Linux/libIrrlicht.a(COpenGLExtensionHandler.o): In function `irr::video::COpenGLExtensionHandler::initExtensions(bool)':
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:502: undefined reference to `glGetFloatv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:504: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:506: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:511: undefined reference to `glGetIntegerv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:521: undefined reference to `glGetFloatv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:522: undefined reference to `glGetFloatv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:523: undefined reference to `glGetFloatv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:524: undefined reference to `glGetFloatv'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:528: undefined reference to `glGetError'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:530: undefined reference to `glGetString'
/home/ragnarch/libraries/irrlicht-1.7.2/source/Irrlicht/COpenGLExtensionHandler.cpp:534: undefined reference to `glGetError'
...

This "libraries" folder doesn't even exist.

I used these tutorials
http://www.cs.swarthmore.edu/~adanner/tips/cmake.php
http://irrlicht.sourceforge.net/forum/v ... hp?t=37091
Last edited by ragnatic on Sun Feb 26, 2012 4:14 am, edited 1 time in total.
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Generate a make file from a Codeblocks project

Post by CuteAlien »

The errors are because you don't link opengl, that's -lGL. By the way Irrlicht comes also with a Makefile - and additionally you could probably get CodeBlocks running in ArchLinux I guess (although I never tried that one).
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Ethon
Posts: 21
Joined: Wed Nov 30, 2011 10:01 am

Re: Generate a make file from a Codeblocks project

Post by Ethon »

CuteAlien wrote:and additionally you could probably get CodeBlocks running in ArchLinux I guess (although I never tried that one).
pacman -S codeblocks
Thats it.
ragnatic
Posts: 14
Joined: Sun Nov 22, 2009 5:11 am

Re: Generate a make file from a Codeblocks project

Post by ragnatic »

CuteAlien wrote:The errors are because you don't link opengl, that's -lGL. By the way Irrlicht comes also with a Makefile - and additionally you could probably get CodeBlocks running in ArchLinux I guess (although I never tried that one).
I'm trying to generate a make file from a Codeblocks project that uses Irrlicht. I'm trying to generate a static library which is done, as in IrrCompileConfig says

// To build Irrlicht as a static library, you must define _IRR_STATIC_LIB_ in both the
// Irrlicht build, *and* in the user application, before #including <irrlicht.h>

I have a #define _IRR_STATIC_LIB_ before #include <irrlicht.h> in my main but I'm not quite sure where is this "Irrlicht build" place.

Edit: Well, I saw a static build option in irrlicht codeblocks project located in the source folder. That build has the _IRR_STATIC_LIB_ flag and it seems that I'm all set. But now I get this when I'm compiling my project after getting the make file with cmake

undefined reference to `createDevice'|
CuteAlien
Admin
Posts: 9679
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Generate a make file from a Codeblocks project

Post by CuteAlien »

Do you link to Irrlicht?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply