SRombauts / SQLiteCpp

SQLiteC++ (SQLiteCpp) is a smart and easy to use C++ SQLite3 wrapper.
http://srombauts.github.io/SQLiteCpp
MIT License
2.19k stars 509 forks source link

MSVC: Unresolved symbol SQLite::assertion_failed for example1 #459

Open thbeu opened 6 months ago

thbeu commented 6 months ago

When configuring with -DSQLITE_ENABLE_ASSERT_HANDLER:BOOL=ON (and building static libs) the example1 fails to build on MSVC with

main.obj : error LNK2019: unresolved external symbol "void cdecl SQLite::assertion_failed(char const ,int,char const ,char const ,char const )" (?assertion_failed@SQLite@@YAXPEBDH000@Z) referenced in function main SQLiteCpp.lib(Database.obj) : error LNK2001: unresolved external symbol "void cdecl SQLite::assertion_failed(char const ,int,char const ,char const ,char const )" (?assertion_failed@SQLite@@YAXPEBDH000@Z) C:\Path\win64\bin\Release\SQLiteCpp_example1.exe : fatal error LNK1120: 1 unresolved externals

Can be easily fixed if the declarations of SQLite::assertion_failed are identical in

https://github.com/SRombauts/SQLiteCpp/blob/7dbcf482f25a1bed246051d875f2e0849a6ddddb/examples/example1/main.cpp#L26

and

https://github.com/SRombauts/SQLiteCpp/blob/7dbcf482f25a1bed246051d875f2e0849a6ddddb/include/SQLiteCpp/Assertion.h#L29

Note the const long apLine vs. const int apLine.