Reputation: 37
I've scoured SO and found some similar questions, but nothing in the answers helped me.
I'm in no way a seasoned c++
programmer, and it feels like I'm hitting a brick wall with this library.
Though I don't want to give it up, I want to learn how to do it.
Am I missing something basic?
My steps for building xlnt
library:
cmake ..
the source of xlnt
Release x64
Sample test code:
#include "xlnt/xlnt.hpp"
int main()
{
xlnt::workbook wb;
xlnt::worksheet ws = wb.active_sheet();
ws.cell("A1").value(5);
ws.cell("B2").value("string data");
ws.cell("C3").formula("=RAND()");
wb.save("example.xlsx");
return 0;
}
Project properties with .hpp
and .lib
directories:
Project properties with dependencies:
(I've also copied the xlnt.dll
to the root of my project)
Errors I get when I try to run the code:
1>------ Build started: Project: xlnt-test, Configuration: Release x64 ------
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::exception::`vftable'" (??_7exception@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::illegal_character::`vftable'" (??_7illegal_character@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_attribute::`vftable'" (??_7invalid_attribute@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_cell_reference::`vftable'" (??_7invalid_cell_reference@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_column_index::`vftable'" (??_7invalid_column_index@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_data_type::`vftable'" (??_7invalid_data_type@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_file::`vftable'" (??_7invalid_file@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_parameter::`vftable'" (??_7invalid_parameter@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::invalid_sheet_title::`vftable'" (??_7invalid_sheet_title@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::detail::izstream::`vftable'" (??_7izstream@detail@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::key_not_found::`vftable'" (??_7key_not_found@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::missing_number_format::`vftable'" (??_7missing_number_format@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::no_visible_worksheets::`vftable'" (??_7no_visible_worksheets@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::detail::ozstream::`vftable'" (??_7ozstream@detail@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::unhandled_switch_case::`vftable'" (??_7unhandled_switch_case@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::unsupported::`vftable'" (??_7unsupported@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::detail::vector_istreambuf::`vftable'" (??_7vector_istreambuf@detail@xlnt@@6B@)
1>xlnt.exp : error LNK2001: unresolved external symbol "const xlnt::detail::vector_ostreambuf::`vftable'" (??_7vector_ostreambuf@detail@xlnt@@6B@)
1>D:\Docs\Programming\cpp\xlnt-test\x64\Release\xlnt-test.exe : fatal error LNK1120: 18 unresolved externals
1>Done building project "xlnt-test.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Upvotes: 0
Views: 1032
Reputation: 1368
I tested the library for you. It work after dowing this:
MyTestApplication
) G:\CMake\Sources\xlnt-master\include
) In debug mode, the genereated library is called xlntd.lib
(with d
suffix)
..\source\$(Configuration)\xlntd.lib
at Linker -> Input
Debug
in debug mode ..\source\$(Configuration)\
as additional library directories and put just xlntd.lib
as input lib In Release mode, the genereated library is called xlnt.lib
..\source\$(Configuration)\xlnt.lib
at Linker -> Input
Release
in release mode ..\source\$(Configuration)\
as additional library directories and put just xlnt.lib
as input lib After dowing this, it should be OK
:
Upvotes: 1