Cześć Wam!
Próbuję napisać CmakeLists z
FBX SDK, żeby móc ładować modele 3D *.fbx. Napisałem CMakeLists ale źle ponieważ wyrzuca błędy podczas dołączania nagłówka
#include <fbxsdk.h>
. Męczę się z tym już od dłuższego czasu i niestety nie wiem jak poprawnie napisać cmake a ChatGPT nie pomógł :-/
Może ktoś coś doradzi ?
cmakelists
cmake_minimum_required(VERSION 3.10)
project(Model3DLoader VERSION 1.0)
# GLAD
add_library(glad STATIC Model3DLoader/glad/src/glad.c)
target_include_directories(glad PUBLIC Model3DLoader/glad/include)
# Główna aplikacja
add_executable(${PROJECT_NAME}
Model3DLoader/main.cpp
)
# Nagłówki
target_sources(${PROJECT_NAME} PRIVATE
Model3DLoader/WideUTF8Converter.hpp
Model3DLoader/Window.hpp
Model3DLoader/Time.hpp
Model3DLoader/Camera.hpp
Model3DLoader/Transform.hpp
Model3DLoader/stb_image.h
Model3DLoader/Textures.hpp
Model3DLoader/Shaders.hpp
Model3DLoader/Programs.hpp
Model3DLoader/Materials.hpp
Model3DLoader/Model3D.hpp
)
# Standard C++
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)
# GLFW
target_include_directories(${PROJECT_NAME} PRIVATE C:/glfw-3.4.bin.WIN64/include)
target_link_directories(${PROJECT_NAME} PRIVATE C:/glfw-3.4.bin.WIN64/lib-vc2022)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw3)
# GLAD
target_link_libraries(${PROJECT_NAME} PRIVATE glad)
# GLM
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/glm)
# FBX SDK
set(FBX_SDK_ROOT "C:/Program Files/Autodesk/FBX/FBX SDK/2020.3.7")
target_include_directories(${PROJECT_NAME} PRIVATE "${FBX_SDK_ROOT}/include")
target_compile_definitions(${PROJECT_NAME} PRIVATE FBXSDK_SHARED)
# Wymuś spójność /MD i /MDd (MSVCRT)
if(MSVC)
# Katalogi z bibliotekami FBX SDK
target_link_directories(${PROJECT_NAME} PRIVATE
"$<$<CONFIG:Debug>:${FBX_SDK_ROOT}/lib/x64/debug>"
"$<$<CONFIG:Release>:${FBX_SDK_ROOT}/lib/x64/release>"
)
# Biblioteki FBX + zależności (zlib, libxml2)
target_link_libraries(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:libfbxsdk-md zlib-md libxml2-md>
$<$<CONFIG:Release>:libfbxsdk-md zlib-md libxml2-md>
)
endif()
# VS debugger path
set_target_properties(${PROJECT_NAME} PROPERTIES
VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Model3DLoader"
)
błędy po dołączeniu nagłówka
9 unresolved externals
unresolved external symbol "__declspec(dllimport) public: int __cdecl fbxsdk::FbxString::Compare(char const *)const " (__imp_?Compare@FbxString@fbxsdk@@QEBAHPEBD@Z) referenced in function "public: int __cdecl fbxsdk::FbxStringCompare::operator()(class fbxsdk::FbxString const &,class fbxsdk::FbxString const &)const " (??RFbxStringCompare@fbxsdk@@QEBAHAEBVFbxString@1@0@Z)
unresolved external symbol "__declspec(dllimport) public: void * __cdecl fbxsdk::FbxBaseAllocator::AllocateRecords(unsigned __int64)" (__imp_?AllocateRecords@FbxBaseAllocator@fbxsdk@@QEAAPEAX_K@Z) referenced in function "public: class fbxsdk::FbxPair<class fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::RecordType *,bool> __cdecl fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::Insert(class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair const &)" (?Insert@?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@QEAA?AV?$FbxPair@PEAVRecordType@?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@_N@2@AEBVKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@2@@Z)
unresolved external symbol "__declspec(dllimport) public: void __cdecl fbxsdk::FbxBaseAllocator::FreeMemory(void *)" (__imp_?FreeMemory@FbxBaseAllocator@fbxsdk@@QEAAXPEAX@Z) referenced in function "public: void __cdecl fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::Clear(void)" (?Clear@?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@QEAAXXZ)
unresolved external symbol "__declspec(dllimport) public: void __cdecl fbxsdk::FbxBaseAllocator::Reserve(unsigned __int64)" (__imp_?Reserve@FbxBaseAllocator@fbxsdk@@QEAAX_K@Z) referenced in function "public: void __cdecl fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::Reserve(unsigned int)" (?Reserve@?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@QEAAXI@Z)
unresolved external symbol "__declspec(dllimport) public: __cdecl fbxsdk::FbxBaseAllocator::FbxBaseAllocator(unsigned __int64)" (__imp_??0FbxBaseAllocator@fbxsdk@@QEAA@_K@Z) referenced in function "public: __cdecl fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>(void)" (??0?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@QEAA@XZ)
unresolved external symbol "__declspec(dllimport) public: __cdecl fbxsdk::FbxString::FbxString(class fbxsdk::FbxString const &)" (__imp_??0FbxString@fbxsdk@@QEAA@AEBV01@@Z) referenced in function "public: __cdecl fbxsdk::FbxPair<class fbxsdk::FbxString const ,class fbxsdk::FbxObject *>::FbxPair<class fbxsdk::FbxString const ,class fbxsdk::FbxObject *>(class fbxsdk::FbxPair<class fbxsdk::FbxString const ,class fbxsdk::FbxObject *> const &)" (??0?$FbxPair@$$CBVFbxString@fbxsdk@@PEAVFbxObject@2@@fbxsdk@@QEAA@AEBV01@@Z)
unresolved external symbol "__declspec(dllimport) public: __cdecl fbxsdk::FbxString::operator char const *(void)const " (__imp_??BFbxString@fbxsdk@@QEBAPEBDXZ) referenced in function "public: int __cdecl fbxsdk::FbxStringCompare::operator()(class fbxsdk::FbxString const &,class fbxsdk::FbxString const &)const " (??RFbxStringCompare@fbxsdk@@QEBAHAEBVFbxString@1@0@Z)
unresolved external symbol "__declspec(dllimport) public: __cdecl fbxsdk::FbxString::~FbxString(void)" (__imp_??1FbxString@fbxsdk@@QEAA@XZ) referenced in function "public: __cdecl fbxsdk::FbxPair<class fbxsdk::FbxString const ,class fbxsdk::FbxObject *>::~FbxPair<class fbxsdk::FbxString const ,class fbxsdk::FbxObject *>(void)" (??1?$FbxPair@$$CBVFbxString@fbxsdk@@PEAVFbxObject@2@@fbxsdk@@QEAA@XZ)
unresolved external symbol "__declspec(dllimport) void __cdecl fbxsdk::_FbxAssert(char const *,char const *,unsigned int,bool,char const *,...)" (__imp_?_FbxAssert@fbxsdk@@YAXPEBD0I_N0ZZ) referenced in function "protected: void __cdecl fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::FixNodesAfterRemoval(class fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::RecordType *,class fbxsdk::FbxRedBlackTree<class fbxsdk::FbxMap<class fbxsdk::FbxString,class fbxsdk::FbxObject *,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::KeyValuePair,struct fbxsdk::FbxStringCompare,class fbxsdk::FbxBaseAllocator>::RecordType *)" (?FixNodesAfterRemoval@?$FbxRedBlackTree@VKeyValuePair@?$FbxMap@VFbxString@fbxsdk@@PEAVFbxObject@2@UFbxStringCompare@2@VFbxBaseAllocator@2@@fbxsdk@@UFbxStringCompare@3@VFbxBaseAllocator@3@@fbxsdk@@IEAAXPEAVRecordType@12@0@Z)