This question already has answers here:
How to add "-l" (ell) compiler flag in CMake
(2 answers)
Closed 3 years ago.
I am trying to use curl inside c++ code. How should i do it properly ?
I have pasted libcurl.a & libcurl.dll.a in this directory:
C:\Program Files\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\lib
This is my CMakeLists.txt from CLion/Mingw
cmake_minimum_required(VERSION 3.3)
project(tan)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -lcurl.dll")
add_executable(tan Tan/mail.cpp)
project(untitled6)
When I add "#define CURL_STATICLIB" i get these errors:
reference to `curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined
reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tam/mail.cpp:121: undefined reference to ````curl_easy_cleanup
Without "#define CURL_STATICLIB" i get these errors:
CMakeFiles\tan.dir/objects.a(mail.cpp.obj): In function `main':
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:81: undefined reference to `__imp_curl_easy_init'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:84: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:86: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:91: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:92: undefined reference to `__imp_curl_slist_append'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:93: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:98: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:99: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:100: undefined reference to `__imp_curl_easy_setopt'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:103: undefined reference to `__imp_curl_easy_perform'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:107: undefined reference to `__imp_curl_easy_strerror'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:111: undefined reference to `__imp_curl_slist_free_all'
C:/Users/John/CLionProjects/tan/Tan/mail.cpp:121: undefined reference to `__imp_curl_easy_cleanup'
If anybody comes looking use this in CMakeLists.txt. The last line solved the issue.
Step1:
Copy libcurl.dll.a in C:/curl.
No need to copy "libcurl.a" OR "libcurl.dll.a" at any other place.
No need for #define CURL_STATICLIB in main.cpp file
Step2: Edit the CMakeLists.txt as below.
set(CMAKE_CXX_STANDARD 14)
add_executable(tan Tan/mail.cpp)
project(untitled6)
target_link_libraries(tan "C:/curl/libcurl.dll.a")
Step3: If your program flashes quickly and closes. You might be missing some dll files. To check which ones you are missing , run the program (in my case tan.exe) with cmd. Take that dll from curl package (in my case curl-7.65.0-win64-mingw) and put it along side of your executable file. Make sure curl and your executable is compiled with same compiler. In my case it's Mingw.
So I followed the Ubuntu instructions on the Datastax website to build the c++ driver (http://datastax.github.io/cpp-driver/topics/building/).
sudo apt-add-repository ppa:linuxjedi/ppa
sudo apt-get update
sudo apt-get install g++ make cmake libuv-dev libssl-dev
git clone https://github.com/datastax/cpp-driver.git
mkdir cpp-driver/build
cd cpp-driver/build
cmake ..
make
When I try to compile using g++ I get the following error messages:
test.cpp:(.text+0x11): undefined reference to cass_cluster_new'
test.cpp:(.text+0x1a): undefined reference tocass_session_new'
test.cpp:(.text+0x2f): undefined reference to cass_cluster_set_contact_points'
test.cpp:(.text+0x42): undefined reference tocass_session_connect'
test.cpp:(.text+0x52): undefined reference to cass_future_error_code'
test.cpp:(.text+0x76): undefined reference tocass_statement_new'
test.cpp:(.text+0x8d): undefined reference to cass_session_execute'
test.cpp:(.text+0x9d): undefined reference tocass_future_error_code'
test.cpp:(.text+0xb6): undefined reference to cass_future_get_result'
test.cpp:(.text+0xc6): undefined reference tocass_iterator_from_result'
test.cpp:(.text+0xd8): undefined reference to cass_iterator_get_row'
test.cpp:(.text+0xed): undefined reference tocass_row_get_column_by_name'
test.cpp:(.text+0x108): undefined reference to cass_value_get_string'
test.cpp:(.text+0x12d): undefined reference tocass_iterator_next'
test.cpp:(.text+0x142): undefined reference to cass_result_free'
test.cpp:(.text+0x14e): undefined reference tocass_iterator_free'
test.cpp:(.text+0x167): undefined reference to cass_future_error_message'
test.cpp:(.text+0x196): undefined reference tocass_statement_free'
test.cpp:(.text+0x1a2): undefined reference to cass_future_free'
test.cpp:(.text+0x1ae): undefined reference tocass_session_close'
test.cpp:(.text+0x1be): undefined reference to cass_future_wait'
test.cpp:(.text+0x1ca): undefined reference tocass_future_free'
test.cpp:(.text+0x1e3): undefined reference to cass_future_error_message'
test.cpp:(.text+0x212): undefined reference tocass_future_free'
test.cpp:(.text+0x21e): undefined reference to cass_cluster_free'
test.cpp:(.text+0x22a): undefined reference tocass_session_free'
collect2: error: ld returned 1 exit status
What am I missing when trying to compile: g++ test.cpp
Thank you.
You need to actually link to the previously build cassandra driver.
g++ test.cpp -Lcpp-build/build -lcassandra
-L tells g++ where it searches for libraries
-l links the library
I am trying to make .lib file of ARPACK library to use with VS2012 Express Edition. Hence I am using the command in MSYS as :
dllwrap --export-all-symbols BLAS/.o LAPACK/.o SRC/.o UTIL/.o
-lgfortran --output-def arpack_win32.def -o arpack_win32.dll
This results in error:
real_write' UTIL/smout.o:smout.f:(.text+0x12cf): undefined reference
to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x12f1): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13b4): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x13ef): undefined reference to
_gfortran_transfer_ real_write' UTIL/smout.o:smout.f:(.text+0x1581):
undefined reference to _gfortran_transfer_ array_write'
UTIL/smout.o:smout.f:(.text+0x15a3): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x1666): undefined reference to
_gfortran_transfer_ integer_write'
UTIL/smout.o:smout.f:(.text+0x16a1): undefined reference to
_gfortran_transfer_ real_write' UTIL/svout.o:svout.f:(.text+0xb4):
undefined reference to _gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0xd2): undefined reference to
_gfortran_transfer_ch aracter_write'
UTIL/svout.o:svout.f:(.text+0x1b5): undefined reference to
_gfortran_transfer_i nteger_write'
UTIL/svout.o:svout.f:(.text+0x1cd): undefined reference to
_gfortran_transfer_i nteger_write'
Cant figure it out why this happens....Thanks..
Finally figured out what was wrong....I was using MinGW with gfortran..... Adding C:\MinGW\bin to PATH solved all the issues.....
I'm using robo robo simulator. It requires SDL to be installed. SDL was successfully installed using sudo apt-get install in Ubuntu
'make' was used to compile and link.
compilation was successful but while linking I got the following linker errors
[LD] roborobo
src/core/roborobo.o: In function `clean_up()':
roborobo.cpp:(.text+0x29): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x35): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x41): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x4d): undefined reference to `SDL_FreeSurface'
roborobo.cpp:(.text+0x59): undefined reference to `SDL_FreeSurface'
src/core/roborobo.o:roborobo.cpp:(.text+0x6a): more undefined references to `SDL_FreeSurface' follow
src/core/roborobo.o: In function `checkQuitEvent()':
roborobo.cpp:(.text+0xdff): undefined reference to `SDL_PollEvent'
src/core/roborobo.o: In function `handleKeyEvent(unsigned char*)':
roborobo.cpp:(.text+0xead): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf1a): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0xf43): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x1037): undefined reference to `SDL_Delay'
roborobo.cpp:(.text+0x111e): undefined reference to `SDL_Delay'
src/core/roborobo.o:roborobo.cpp:(.text+0x1191): more undefined references to `SDL_Delay' follow
and many more
SDL_gfxPrimitives.c:(.text+0x7477): undefined reference to `SDL_UnlockSurface'
SDL_gfxPrimitives.c:(.text+0x7491): undefined reference to `SDL_UpperBlit'
SDL_gfxPrimitives.c:(.text+0x74e6): undefined reference to `SDL_CreateRGBSurface'
collect2: error: ld returned 1 exit status
make: [roborobo] Error 1 (ignored)
the make file also has sdl-config --cflags --libs -lSDL_image
the Makefile is in http://pastebin.com/5EdcZWAd
the entire console output after 'make' is in http://pastebin.com/yXDHR9xw
I'm writing a Qt application that uses Botan. For the Windows version I decided to use the precompiled DLL, so I downloaded the installer, installed Botan in C:\botan and added:
win32:INCLUDEPATH += C:/botan/include
win32:LIBS += -L"C:\botan" -lbotan
to my .pro file. However I'm getting linker errors (undefined reference to...) during the build process, and I can't see why - the correct .lib is specified in LIBS, the include path is fine.
I'm using MinGW.
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:52: undefined reference to `_imp___ZN5Botan17have_block_cipherERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:58: undefined reference to `_imp___ZN5Botan16max_keylength_ofERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:59: undefined reference to `_imp___ZN5Botan13block_size_ofERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:61: undefined reference to `_imp___ZN5Botan14AutoSeeded_RNGC1Ej'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:63: undefined reference to `_imp___ZN5Botan7get_s2kERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:64: undefined reference to `_imp___ZN5Botan3S2K14set_iterationsEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:65: undefined reference to `_imp___ZN5Botan3S2K15new_random_saltERNS_21RandomNumberGeneratorEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:67: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:68: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:69: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan10MAC_FilterC1ERKSsRKNS_11OctetStringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan14Base64_EncoderC1Ebjb'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan5ChainC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan10get_cipherERKSsRKNS_11OctetStringES4_NS_10Cipher_DirE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan14Base64_EncoderC1Ebjb'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan5ChainC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan4ForkC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan4PipeC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:85: undefined reference to `_imp___ZN5Botan4Pipe9start_msgEv'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:83: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:86: undefined reference to `_imp___ZN5BotanrsERSiRNS_4PipeE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:87: undefined reference to `_imp___ZN5Botan4Pipe7end_msgEv'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:89: undefined reference to `_imp___ZN5Botan4Pipe18read_all_as_stringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:90: undefined reference to `_imp___ZN5Botan4Pipe18read_all_as_stringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:90: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:90: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:142: undefined reference to `_imp___ZN5Botan17have_block_cipherERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:148: undefined reference to `_imp___ZN5Botan16max_keylength_ofERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:149: undefined reference to `_imp___ZN5Botan13block_size_ofERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:151: undefined reference to `_imp___ZN5Botan7get_s2kERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:152: undefined reference to `_imp___ZN5Botan3S2K14set_iterationsEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:153: undefined reference to `_imp___ZN5Botan3S2K11change_saltERKNS_12MemoryRegionIhEE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:155: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:156: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:157: undefined reference to `_imp___ZNK5Botan3S2K10derive_keyEjRKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan10MAC_FilterC1ERKSsRKNS_11OctetStringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan14Base64_EncoderC1Ebjb'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan5ChainC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan4ForkC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan10get_cipherERKSsRKNS_11OctetStringES4_NS_10Cipher_DirE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan14Base64_DecoderC1ENS_16Decoder_CheckingE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan4PipeC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:166: undefined reference to `_imp___ZN5Botan4Pipe9start_msgEv'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:164: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:167: undefined reference to `_imp___ZN5BotanrsERSiRNS_4PipeE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:168: undefined reference to `_imp___ZN5Botan4Pipe7end_msgEv'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:170: undefined reference to `_imp___ZN5Botan4Pipe18read_all_as_stringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:174: undefined reference to `_imp___ZN5Botan4Pipe18read_all_as_stringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:174: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:174: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:195: undefined reference to `_imp___ZN5Botan14Base64_EncoderC1Ebjb'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:195: undefined reference to `_imp___ZN5Botan4PipeC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:196: undefined reference to `_imp___ZN5Botan4Pipe11process_msgERKNS_12MemoryRegionIhEE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:197: undefined reference to `_imp___ZN5Botan4Pipe15DEFAULT_MESSAGEE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:197: undefined reference to `_imp___ZN5Botan4Pipe18read_all_as_stringEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:197: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:197: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:202: undefined reference to `_imp___ZN5Botan14Base64_DecoderC1ENS_16Decoder_CheckingE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:202: undefined reference to `_imp___ZN5Botan4PipeC1EPNS_6FilterES2_S2_S2_'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:203: undefined reference to `_imp___ZN5Botan4Pipe11process_msgERKSs'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:204: undefined reference to `_imp___ZN5Botan4Pipe15DEFAULT_MESSAGEE'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:204: undefined reference to `_imp___ZN5Botan4Pipe8read_allEj'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:204: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o:D:\Development\Qt\silverlock-build-desktop\silverlocklib/../../Silverlock/silverlocklib/databasecrypto.cpp:204: undefined reference to `_imp___ZN5Botan4PipeD1Ev'
./debug\databasecrypto.o: In function `LibraryInitializer':
c:/botan/include/botan/init.h:34: undefined reference to `_imp___ZN5Botan18LibraryInitializer10initializeERKSs'
./debug\databasecrypto.o: In function `~LibraryInitializer':
c:/botan/include/botan/init.h:36: undefined reference to `_imp___ZN5Botan18LibraryInitializer12deinitializeEv'
./debug\databasecrypto.o: In function `~Exception':
c:/botan/include/botan/exceptn.h:25: undefined reference to `_imp___ZTVN5Botan9ExceptionE'
c:/botan/include/botan/exceptn.h:25: undefined reference to `_imp___ZTVN5Botan9ExceptionE'
c:/botan/include/botan/exceptn.h:25: undefined reference to `_imp___ZTVN5Botan9ExceptionE'
./debug\databasecrypto.o: In function `~Format_Error':
c:/botan/include/botan/exceptn.h:110: undefined reference to `_imp___ZTVN5Botan12Format_ErrorE'
c:/botan/include/botan/exceptn.h:110: undefined reference to `_imp___ZTVN5Botan12Format_ErrorE'
c:/botan/include/botan/exceptn.h:110: undefined reference to `_imp___ZTVN5Botan12Format_ErrorE'
./debug\databasecrypto.o: In function `~Decoding_Error':
c:/botan/include/botan/exceptn.h:135: undefined reference to `_imp___ZTVN5Botan14Decoding_ErrorE'
c:/botan/include/botan/exceptn.h:135: undefined reference to `_imp___ZTVN5Botan14Decoding_ErrorE'
./debug\databasecrypto.o: In function `Exception':
c:/botan/include/botan/exceptn.h:21: undefined reference to `_imp___ZTVN5Botan9ExceptionE'
./debug\databasecrypto.o: In function `~RandomNumberGenerator':
c:/botan/include/botan/rng.h:78: undefined reference to `_imp___ZTVN5Botan21RandomNumberGeneratorE'
c:/botan/include/botan/rng.h:78: undefined reference to `_imp___ZTVN5Botan21RandomNumberGeneratorE'
c:/botan/include/botan/rng.h:78: undefined reference to `_imp___ZTVN5Botan21RandomNumberGeneratorE'
./debug\databasecrypto.o: In function `~AutoSeeded_RNG':
c:/botan/include/botan/auto_rng.h:37: undefined reference to `_imp___ZTVN5Botan14AutoSeeded_RNGE'
c:/botan/include/botan/auto_rng.h:37: undefined reference to `_imp___ZTVN5Botan14AutoSeeded_RNGE'
./debug\databasecrypto.o: In function `Algorithm_Not_Found':
c:/botan/include/botan/exceptn.h:102: undefined reference to `_imp___ZTVN5Botan19Algorithm_Not_FoundE'
./debug\databasecrypto.o: In function `~Algorithm_Not_Found':
c:/botan/include/botan/exceptn.h:102: undefined reference to `_imp___ZTVN5Botan19Algorithm_Not_FoundE'
c:/botan/include/botan/exceptn.h:102: undefined reference to `_imp___ZTVN5Botan19Algorithm_Not_FoundE'
./debug\databasecrypto.o: In function `Format_Error':
c:/botan/include/botan/exceptn.h:110: undefined reference to `_imp___ZTVN5Botan12Format_ErrorE'
./debug\databasecrypto.o: In function `Decoding_Error':
c:/botan/include/botan/exceptn.h:135: undefined reference to `_imp___ZTVN5Botan14Decoding_ErrorE'
collect2: ld returned 1 exit status
Since Botan is included in QtCreator (2.x branches), you could just recompile QtCreator (or take the relevant parts), and use that. No messing with any makefiles (mingw works out of the box), and since you mention Qt, this will probably work very well.
As far as I know, official binaries are compatible with MSVC only. I guess you should build Botan from source to use it with MinGW. According to docs it's relatively easy to do:
$ python configure.py
$ make
$ make check
$ make install
But for me compiler autodetection didn't work as expected, so I had to do few additional steps:
Autoconfiguration:
$ python configure.py --cc=gcc
Edit generated Makefile. Replace line
LINK_TO = -ladvapi32.lib -luser32.lib
with
LINK_TO = -ladvapi32 -luser32
Build
$ make
$ make check
$ make install
I've used this command to build botan using mingw32-make.exe, i've ran it in a console window with Qt support.
python configure.py --cc=gcc --cpu=x86 --os=mingw --without-stack-protector --amalgamation --minimized-build --disable-shared --enable-modules=aes,aes_ssse3,auto_rng,bigint,block,cbc,ctr,des,dh,dsa,ec_group,ecdh,ecdsa,entropy,filters,hmac,mode_pad,pubkey,rsa,sha1,sha1_sse2,sha1_x86,sha2_32,sha2_32_x86,sha2_64,simd,system_rng,emsa_pkcs1,pbes2,pbkdf2 --without-documentation
mingw32-make.exe
mingw32-make.exe install