我在OSX上使用带有CLion的openGL,并尝试为某些对象添加纹理。
我相信我的CMake列表是正确的,但是在使用
创建纹理时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
);
我收到以下错误:
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
我一直在网上搜索,因为我的印象是我的CMake列表设置不正确(这是我的第一个使用CMake的项目,所以我很安静)。
我已尝试在目录中移动crate.png
文件,因为我不确定它是否在正确的位置。
它的路径是:CLionProjects/GraphicsProgramming/gfx/crate.png
这就是我的CMake列表:
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)
我想知道我哪里出错了。
一如既往,任何帮助表示赞赏。
更新了CMake列表中的代码,现在收到此错误:
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