Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

[FBX SDK] Początki czyli CMakeLists

Ostatnio zmodyfikowano 2025-06-30 16:29
Autor Wiadomość
tBane
Temat założony przez niniejszego użytkownika
[FBX SDK] Początki czyli CMakeLists
» 2025-06-30 15:46:28
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)

P-182622
tBane
Temat założony przez niniejszego użytkownika
» 2025-06-30 16:04:40
Dobra mam coś takiego i przy inkludowaniu <fbxsdk.h> nie wyrzuca błędu:


cmake_minimum_required(VERSION 3.10)
project(Model3DLoader VERSION 1.0)

add_library(glad STATIC Model3DLoader/glad/src/glad.c)
target_include_directories(glad PUBLIC Model3DLoader/glad/include)

# main
add_executable(${PROJECT_NAME}
    Model3DLoader/main.cpp
)

# headers
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 (binary version)
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)

#  GLFW
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")

# FBX include directory
target_include_directories(${PROJECT_NAME} PRIVATE "${FBX_SDK_ROOT}/include")

# FBX lib directory
if(MSVC)
    target_link_directories(${PROJECT_NAME} PRIVATE
        "$<$<CONFIG:Debug>:${FBX_SDK_ROOT}/lib/x64/debug>"
        "$<$<CONFIG:Release>:${FBX_SDK_ROOT}/lib/x64/release>"
    )

    target_link_libraries(${PROJECT_NAME} PRIVATE
        $<$<CONFIG:Debug>:libfbxsdk-md>
        $<$<CONFIG:Release>:libfbxsdk-md>
    )
endif()

# VS debugger path
set_target_properties(${PROJECT_NAME} PROPERTIES
    VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}/Model3DLoader"
)
P-182623
tBane
Temat założony przez niniejszego użytkownika
» 2025-06-30 16:16:32
Nie działa mi poniższy kod - wyrzuca sporo błędów:

C/C++
FbxManager * manager = FbxManager::Create();
if( !manager ) {
   
std::cerr << "Nie udało się utworzyć FbxManager.\n";
   
return;
}
P-182624
tBane
Temat założony przez niniejszego użytkownika
» 2025-06-30 16:29:36
Dobra jeszcze poprawiłem cmakelists i teraz ładuje powyższy kod

cmakelists

cmake_minimum_required(VERSION 3.10)
project(Model3DLoader VERSION 1.0)

add_library(glad STATIC Model3DLoader/glad/src/glad.c)
target_include_directories(glad PUBLIC Model3DLoader/glad/include)

# main
add_executable(${PROJECT_NAME}
    Model3DLoader/main.cpp
)

# headers
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 (binary version)
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)

# GLFW
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")

# FBX include directory
target_include_directories(${PROJECT_NAME} PRIVATE "${FBX_SDK_ROOT}/include")

# FBX lib directory
if(MSVC)
    target_link_directories(${PROJECT_NAME} PRIVATE
        "$<$<CONFIG:Debug>:${FBX_SDK_ROOT}/lib/x64/debug>"
        "$<$<CONFIG:Release>:${FBX_SDK_ROOT}/lib/x64/release>"
    )

    target_link_libraries(${PROJECT_NAME} PRIVATE
        $<$<CONFIG:Debug>:libfbxsdk-md>
        $<$<CONFIG:Release>:libfbxsdk-md>
    )

    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"
)
P-182625
« 1 »
  Strona 1 z 1