I am trying to get conan working in a test project by following their Geting Started guide so that I can begin using it in a real project. I am attempting to use SDL2 with glew in a C++ project compiled with g++ on Ubuntu 16.10 x64.
My conanfile.txt looks like this:
[requires]
SDL2/2.0.5@lasote/stable
glew/2.0.0@coding3d/stable
[generators]
cmake
My CMakeLists.txt file looks like this:
project(conantest)
cmake_minimum_required(VERSION 3.5)
set(CMAKE_CXX_STANDARD 11)
include(conan/conanbuildinfo.cmake)
conan_basic_setup()
set(SRC_FILES main.cpp Display.cpp)
add_executable(conantest ${SRC_FILES})
My project consists of a directory containing CMakeLists.txt, conanfile.txt, all of my source code, a build directory for Cmake, a conan directory for Conan, and a rebuild.sh. I am using this rebuild.sh script to clean and build the project whenever I make a change to the build environment (the rm -r's, although suboptimal once it is working are there to ensure any errors from the previous setup are removed once I attempt a fix).
My rebuild.sh looks like this:
rm -r ./build/*
rm -r ./conan/*
cd conan
conan install ..
cd ../build
cmake ..
make
When I run this script, everything seems to be working until the
final executable is linked. When this happens, I get Display.cpp:(.text+0x8a): undefined reference to `SDL_Init'
. To solve this, I have tried the solutions here and here. Although these are not specific to SDL, I was unable to find any resources that are.
Here is a zip file of the full environment that I am using, including a MCVE.