I'm using openGL with CLion on OSX and am trying to add textures to some objects.
I believe my CMake list is correct however when creating a texture using
myTexture = SOIL_load_OGL_texture(
"gfx/crate.png",
SOIL_LOAD_AUTO,
SOIL_CREATE_NEW_ID,
SOIL_FLAG_MIPMAPS | SOIL_FLAG_NTSC_SAFE_RGB | SOIL_FLAG_COMPRESS_TO_DXT
);
I am getting the following errors:
Undefined symbols for architecture x86_64:
"_SOIL_load_OGL_texture", referenced from:
Scene::Scene(Input*) in Scene.cpp.o
ld: symbol(s) not found for architecture x86_64
I've been searching online because I was under the impression it was my CMake list that was set up incorrectly (its my first project using CMake so i'm quiet new to it).
I've tried moving the crate.png
file around in the directory as I wasn't sure if it was in the correct place.
The path for it is: CLionProjects/GraphicsProgramming/gfx/crate.png
This is what my CMake list looks like:
cmake_minimum_required(VERSION 3.8)
project(GraphicsProgramming5)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.8")
INCLUDE_DIRECTORIES (/System/Library/Frameworks ${SOIL_INCLUDE_DIRS})
find_library(SOIL_LIBRARY SOIL.lib)
FIND_LIBRARY(GLUT_LIBRARY GLUT)
FIND_LIBRARY(OpenGL_LIBRARY OpenGL)
MARK_AS_ADVANCED (
GLUT_LIBRARY'
OpenGL_LIBRARY)
SET(EXTRA_LIBS ${GLUT_LIBRARY} ${OpenGL_LIBRARY} ${SOIL_LIBRARY})
set(SOURCE_FILES main.cpp Input.cpp Input.h Scene.cpp Scene.h Vector3.cpp Vector3.h)
add_executable(GraphicsProgramming5 ${SOURCE_FILES})
target_link_libraries(GraphicsProgramming5 ${GLUT_LIBRARY} ${OpenGL_LIBRARY} ${CMAKE_SOURCE_DIR}/libSOIL.a)
I'd like to know where i'm going wrong.
As always, any help appreciated.
Updated the code in the CMake list and now receiving this error:
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
SOIL_LIBRARY
linked by target "GraphicsProgramming_Lab3" in directory /Users/me/CLionProjects/GraphicsProgramming_Lab5