I am trying to set up my code to use the allegro libray, I am using the KDEV4 under mandriva, I installed the allegro-dev package. Then whenusing allegro functions in KDevelop it displays the documentation, so he surely found the library.
However when I compile my source I get allegro_init()
not declared error, so I checked the CMakeLists.txt
file and I think the problem is there:
project(game)
add_executable(game main.cpp)
What I should write to cmake to find and link the library?
I have a general installation where :
/usr/include
/usr/lib
I installed allegro 4.4 under KDE 4.6.5 mandriva 2011 free, cmake 2.8.4.
If it is not obvious my question is what my CMakeLists.txt should looks like to compile with the allegro included.
That's maybe you forget to specify include path or lib path. If your allegro's head files locate in /usr/local/allegro/include ,and allegro's lib file whose name is liballegro.a locate in /usr/local/allegro/lib Add following script resolve your problem perhaps.
INCLUDE_DIRECTORIES(
/usr/local/allegro/include
)
LINK_DIRECTORIES(
/usr/local/allegro/lib
)
TARGET_LINK_LIBRARIES(game
liballegro.a
)