J'essaie d'utiliser Allegro5 dans CLion mais je ne peux pas faire référence à des addons bien qu'il puisse trouver des fichiers en-tête et lib. J'ai la bibliothèque dans "/ usr/lib" et les fichiers d'en-têtes dans "/ usr/include", en plus, j'ai la bibliothèque et les en-têtes dans le répertoire proyect.Problèmes référençant les addons Allegro5
je peux utiliser et compiler ceci:
[..]
al_set_window_title(display, "title");
al_clear_to_color(al_map_rgb(4,0,90));
ALLEGRO_COLOR electric_blue = al_map_rgb(44, 117, 255);
Mais je ne peux pas compiler ce (malgré la détection en-tête et le funcion):
#include <allegro5/allegro_primitives.h>
[..]
al_draw_line(100,500,300,500,electric_blue,6.0);
C'est l'erreur:
Scanning dependencies of target project
[ 9%] Building CXX object CMakeFiles/project.dir/main.cpp.o
[ 18%] Linking CXX executable project
CMakeFiles/project.dir/main.cpp.o: En la función `main':
/home/lifka/Desktop/tetris/project/main.cpp:80: reference to `al_draw_line' undefined
collect2: error: ld devolvió el estado de salida 1
make[2]: *** [CMakeFiles/project.dir/build.make:329: project] Error 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/project.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Il est le CMakeList.txt:
cmake_minimum_required(VERSION 3.7)
project(project)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp [..])
SET(ALLEGRO_ROOT allegro/)
INCLUDE_DIRECTORIES(${ALLEGRO_ROOT}/include)
LINK_DIRECTORIES(/${ALLEGRO_ROOT}/lib)
add_executable(project ${SOURCE_FILES})
TARGET_INCLUDE_DIRECTORIES(project PUBLIC ${ALLEGRO_ROOT})
TARGET_LINK_LIBRARIES(project allegro)
Ceci est la structure du projet:
Qu'est-ce que je fais mal?
Merci, Metinu – Lifka