xlnt
xlnt copied to clipboard
unresolved external symbol with XLNT_STATIC=1
Hello! First of all: thanks for the project!
I included xlnt in my "include" folder and I get this error even though I specified "XLNT_STATIC=1" in preprocessor settings.
Error LNK2001 unresolved external symbol "public: __thiscall xlnt::workbook::~workbook(void)" (??1workbook@xlnt@@QAE@XZ) supNVSE F:\Fallout_NV\RELEASES\SUP NVSE Plugin\SUP_SOURCE\nvse_plugin_example\main.obj 1
Error LNK2001 unresolved external symbol "public: __thiscall xlnt::workbook::workbook(void)" (??0workbook@xlnt@@QAE@XZ) supNVSE F:\Fallout_NV\RELEASES\SUP NVSE Plugin\SUP_SOURCE\nvse_plugin_example\main.obj 1
Error LNK1120 2 unresolved externals supNVSE F:\Fallout_NV\RELEASES\SUP NVSE Plugin\SUP_SOURCE\nvse_plugin_example\Release\supNVSE.dll 1
Code is:
#include <xlnt/xlnt.hpp>
xlnt::workbook wb;
These are link errors; you have to make the linker use the xlnt libraries, like this
https://github.com/pedro-vicente/xlnt_sample
cmake_minimum_required(VERSION 3.17)
set(CMAKE_BUILD_TYPE Debug)
project (xlnt_sample)
set(CMAKE_CXX_STANDARD 17)
option(BUILD_STATIC "BUILD_STATIC" OFF)
if (MSVC)
message(STATUS "Static build: " ${BUILD_STATIC})
if(BUILD_STATIC)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
endif()
endif()
message(STATUS "Source directory is " ${CMAKE_SOURCE_DIR})
message(STATUS "Build directory is " ${CMAKE_CURRENT_BINARY_DIR})
include_directories(${CMAKE_SOURCE_DIR}/xlnt-1.5.0/include)
add_executable(xlnt_sample xlnt_sample.cc)
#//////////////////////////
#link with libraries
#lib_dep contains a cascade definition of all the libraries needed to link
#//////////////////////////
set(lib_dep ${lib_dep})
if (MSVC)
set(lib_dep ${lib_dep} ${CMAKE_SOURCE_DIR}/build/xlnt-1.5.0/source/Debug/xlntd.lib)
set(lib_dep ${lib_dep} ${CMAKE_SOURCE_DIR}/build/xlnt-1.5.0/source/third-party/libstudxml/libstudxml.dir/Debug/libstudxml.lib)
endif()
target_link_libraries(xlnt_sample ${lib_dep})