I'm trying to compile a program in CLion that uses the Assimp library using the MinGW compiler. When building the project it gets up to 77% and gives the following error on the file "SMDLoader.cpp.obj":
C:\Dev\AssimpTest\cmake-build-debug\_deps\assimp-src\code\SMDLoader.cpp: In member function 'void Assimp::SMDImporter::GetAnimationFileList(const string&, Assimp::IOSystem*, std::vector<std::tuple<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&)':
C:\Dev\AssimpTest\cmake-build-debug\_deps\assimp-src\code\SMDLoader.cpp:579:47: error: 'strtok_s' was not declared in this scope
tok1 = strtok_s(&buf[0], "\r\n", &context1);
^
_deps\assimp-build\code\CMakeFiles\assimp.dir\build.make:2246: recipe for target '_deps/assimp-build/code/CMakeFiles/assimp.dir/SMDLoader.cpp.obj' failed
This is the CMakeLists.txt file i'm using:
cmake_minimum_required(VERSION 3.13)
project(AssimpTest)
set(CMAKE_CXX_STANDARD 11)
find_package(assimp 4.1.0 QUIET)
if (NOT assimp_FOUND)
include(FetchContent)
FetchContent_Declare(
assimp
URL https://github.com/assimp/assimp/archive/master.tar.gz
)
FetchContent_GetProperties(raylib)
if (NOT assimp_POPULATED)
set(FETCHCONTENT_QUIET NO)
FetchContent_Populate(assimp)
set(CMAKE_BUILD_TYPE release CACHE STRING "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
add_subdirectory(${assimp_SOURCE_DIR} ${assimp_BINARY_DIR})
endif()
endif()
add_executable(AssimpTest main.cpp)
target_link_libraries(${PROJECT_NAME} assimp)
Here's the main file i'm trying to compile, just in case:
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
int main() {
Assimp::Importer importer;
const char* pFile = R"(C:\Dev\raycast\models\teapot.fbx)";
const aiScene* scene = importer.ReadFile( pFile,
aiProcess_CalcTangentSpace |
aiProcess_Triangulate |
aiProcess_JoinIdenticalVertices |
aiProcess_SortByPType);
if( !scene)
{
printf(importer.GetErrorString());
return -1;
}
printf("Num meshes: %i", scene->mNumMeshes);
return 0;
}
The main reason i'm trying to use Assimp is to import .fbx models into my program, so if there is any way to optimize all of this setup just for that, that would be really helpful! The information i found about the usage of this library with MinGW on the internet was really scarce.
Anyway thanks for help in advance.