Mingw32 error linking -lcrypto with undefined references - c++

I've compiled the OpenSSL library using Mingw32 and MSys with Strawberry Perl.
I used this forum post as a guide, even though it's quite old.
How to build OpenSSL with MinGW in Windows?
Everything went fine, I wanted to compile it as a static library and it worked, but whenever I try to compile the library with my project using g++ I get the following errors, which I have no idea what they mean.
libcrypto.a(e_capi.o):e_capi.c:(.text+0xf1): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x191): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x5ed): undefined reference to `_imp__CertGetCertificateContextProperty#16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xbd3): undefined reference to `_imp__CertGetCertificateContextProperty#16'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xd40): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0xdd9): undefined reference to `_imp__CertFindCertificateInStore#24'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3012): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3051): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x316f): undefined reference to `_imp__CertDuplicateCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x31f1): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x32a5): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x396c): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39ab): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x39c3): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x3a1f): undefined reference to `_imp__CertEnumCertificatesInStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4195): undefined reference to `_imp__CertOpenStore#20'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4208): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4221): undefined reference to `_imp__CertCloseStore#8'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x4359): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(e_capi.o):e_capi.c:(.text+0x440d): undefined reference to `_imp__CertFreeCertificateContext#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbe): undefined reference to `_imp__getnameinfo#28'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xf4): undefined reference to `_imp__ntohs#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x29a): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0x7c0): undefined reference to `_imp__freeaddrinfo#4'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xae8): undefined reference to `_imp__getaddrinfo#16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xbc9): undefined reference to `gai_strerrorW'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xcb3): undefined reference to `_imp__getaddrinfo#16'
libcrypto.a(b_addr.o):b_addr.c:(.text+0xd91): undefined reference to `gai_strerrorW'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xdf): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xf0): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2c7): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x2d8): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x3c1): undefined reference to `_imp__ntohs#4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x41c): undefined reference to `_imp__getsockopt#20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x43a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x45c): undefined reference to `_imp__gethostbyname#4'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4ab): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x4c2): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x54c): undefined reference to `_imp__WSACleanup#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x56d): undefined reference to `_imp__ioctlsocket#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x58a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x757): undefined reference to `_imp__WSAStartup#8'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x768): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x962): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0x9ec): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa25): undefined reference to `_imp__ioctlsocket#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xa42): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xab6): undefined reference to `_imp__getsockname#12'
libcrypto.a(b_sock.o):b_sock.c:(.text+0xb1a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x27): undefined reference to `_imp__socket#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x49): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x11c): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x157): undefined reference to `_imp__connect#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x195): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x1a6): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x264): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x2ca): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x362): undefined reference to `_imp__bind#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x3ba): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x467): undefined reference to `_imp__getsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x47d): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x531): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5dd): undefined reference to `_imp__listen#8'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x5eb): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x675): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x686): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x71a): undefined reference to `_imp__setsockopt#20'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x72b): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x792): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x826): undefined reference to `_imp__accept#12'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x867): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8cb): undefined reference to `_imp__closesocket#4'
libcrypto.a(b_sock2.o):b_sock2.c:(.text+0x8ec): undefined reference to `_imp__closesocket#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1b2): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x1d9): undefined reference to `_imp__send#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x20a): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x281): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2a0): undefined reference to `_imp__send#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x2da): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x34d): undefined reference to `_imp__WSASetLastError#4'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x370): undefined reference to `_imp__recv#16'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x3c2): undefined reference to `_imp__WSAGetLastError#0'
libcrypto.a(bss_sock.o):bss_sock.c:(.text+0x482): undefined reference to `_imp__WSAGetLastError#0'
collect2.exe: error: ld returned 1 exit status
I'm using VSCode as a development environment, this is the build command for the project, extracted from tasks.json:
g++.exe file1.cpp file2.cpp main.cpp -L*folder with the library* -lcrypto -o test.exe

The linker can't find several functions from Crypt32.lib and Ws2_32.lib. Link these to your exe by adding -lws2_32 -lcrypt32 to g++ command line.
#pragma comment(lib, "ws2_32.lib") is a Microsoft specific feature, g++ does not support this, thus you were not able to link libraries with this pragma. See also this post - #pragma comment(lib, "xxx.lib") equivalent under Linux?.

Related

vulkan build undefined reference to `vkEnumerateInstanceExtensionProperties#12'

so i was trying to set up vulkan on vscode in windows.
and i strugle to fix the link errors.
at first i had problems with GLFM
but it looks like i sorted it out, by compiling it with mingw myself.
but now i guess the following link error
undefined reference to `vkEnumerateInstanceExtensionProperties#12'
how should i resolve that issue?
my makefile looks like that at the moment:
DIR1 := external/GLFM/include
DIR2 := external/glm/
DIR3 := external/vulkan/Include
INC=$(DIR1) $(DIR2) $(DIR3)
INC_PARAMS=$(foreach d, $(INC), -I$d)
LDPATHS2 := -Lexternal/GLFM/Lib/ -Lexternal/vulkan/Lib/
LDLIBS = -lglfw3 -lvulkan-1 -lgdi32
VulkanTest: main.cpp
g++ $(CFLAGS) $(INC_PARAMS) $(LDPATHS2) -o VulkanTest main.cpp $(LDLIBS)
EDIT:
i have added the -lgdi32 as that seemed to get rid of all of those
link errors:
C:\Users\Michael\AppData\Local\Temp\ccRgsVDp.o:main.cpp:(.text.startup+0x7c): undefined reference to `vkEnumerateInstanceExtensionProperties#12'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x12b): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x166): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x181): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1d4): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x257): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x29f): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa49): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xa64): undefined reference to `_imp__GetDeviceCaps#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf06): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf23): undefined reference to `_imp__GetDeviceGammaRamp#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xf33): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x107b): undefined reference to `_imp__CreateDCW#16'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x1098): undefined reference to `_imp__SetDeviceGammaRamp#8'
external/GLFM/Lib/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x10a8): undefined reference to `_imp__DeleteDC#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1f5): undefined reference to `_imp__CreateDIBSection#24'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x268): undefined reference to `_imp__CreateBitmap#20'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x295): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x387): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x397): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xbe1): undefined reference to `_imp__CreateRectRgn#16'
external/GLFM/Lib/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc41): undefined reference to `_imp__DeleteObject#4'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x6c4): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xbbf): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0xf4a): undefined reference to `_imp__SwapBuffers#4'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x126e): undefined reference to `_imp__ChoosePixelFormat#8'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x128b): undefined reference to `_imp__SetPixelFormat#12'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15b4): undefined reference to `_imp__DescribePixelFormat#16'
external/GLFM/Lib/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x15fd): undefined reference to `_imp__SetPixelFormat#12'

Can't get a Fast Artificial Neural Net (FANN) project to make. It gives undefined references when certain code is used

I have been having trouble with the Fast Artificial Neural Network (FANN) library. I can't seem to get it completely working on my system. I think I am missing some dependency, but I can't seem to figure out how to fix it.
I am on Ubuntu, but I decided to clone the repository from GitHub rather than use apt-get. I cloned to the directory /home/lucas/includes/fann and from that directory I performed cmake ., and finally sudo make install like instructed at the GitHub readme.
Some parts of the library work, but some crash. Here is my example file:
#include <iostream>
#include <fann.h>
#include <fann_cpp.h>
using namespace std;
using namespace FANN;
int main(int argc, char** argv) {
fann_type** input_data;
//training_data training_data;
return 0;
}
Here is my CMake file:
cmake_minimum_required(VERSION 2.8.4)
project(FANN_sin)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
include_directories(/usr/local/include/)
include_directories(/usr/local/lib/)
set(SOURCE_FILES main.cpp)
add_executable(FANN_sin ${SOURCE_FILES})
target_link_libraries(FANN_sin /usr/local/lib/libfann.a)
When I run the code with the training_data training_data commented out, it compiles and runs. However, when I try to run with that part uncommented, the project won't make.
Here are the errors:
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_batch_parallel._omp_fn.1':
floatfann.c:(.text+0x20): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0x28): undefined reference to `omp_get_thread_num'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_irpropm_parallel._omp_fn.3':
floatfann.c:(.text+0x116): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0x11e): undefined reference to `omp_get_thread_num'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_quickprop_parallel._omp_fn.5':
floatfann.c:(.text+0x304): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0x30c): undefined reference to `omp_get_thread_num'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_sarprop_parallel._omp_fn.7':
floatfann.c:(.text+0x592): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0x59a): undefined reference to `omp_get_thread_num'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_batch_parallel._omp_fn.0':
floatfann.c:(.text+0xf375): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0xf37d): undefined reference to `omp_get_thread_num'
floatfann.c:(.text+0xf3dd): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_irpropm_parallel._omp_fn.2':
floatfann.c:(.text+0xf4c5): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0xf4cd): undefined reference to `omp_get_thread_num'
floatfann.c:(.text+0xf52d): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_quickprop_parallel._omp_fn.4':
floatfann.c:(.text+0xf615): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0xf61d): undefined reference to `omp_get_thread_num'
floatfann.c:(.text+0xf67d): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_sarprop_parallel._omp_fn.6':
floatfann.c:(.text+0xf765): undefined reference to `omp_get_num_threads'
floatfann.c:(.text+0xf76d): undefined reference to `omp_get_thread_num'
floatfann.c:(.text+0xf7cd): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_batch_parallel':
floatfann.c:(.text+0x13a9a): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x13aa1): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x13ac5): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x13ad4): undefined reference to `GOMP_parallel_end'
floatfann.c:(.text+0x13b09): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x13b10): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x13b48): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x13b57): undefined reference to `GOMP_parallel_end'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_irpropm_parallel':
floatfann.c:(.text+0x13e6d): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x13e74): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x13e98): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x13ea7): undefined reference to `GOMP_parallel_end'
floatfann.c:(.text+0x13f09): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x13f10): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x13f79): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x13f88): undefined reference to `GOMP_parallel_end'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_quickprop_parallel':
floatfann.c:(.text+0x142ad): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x142b4): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x142d8): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x142e7): undefined reference to `GOMP_parallel_end'
floatfann.c:(.text+0x14355): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x1435c): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x143dd): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x143ec): undefined reference to `GOMP_parallel_end'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_sarprop_parallel':
floatfann.c:(.text+0x1470d): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x14714): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x14738): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x14747): undefined reference to `GOMP_parallel_end'
floatfann.c:(.text+0x1483d): undefined reference to `omp_set_dynamic'
floatfann.c:(.text+0x14844): undefined reference to `omp_set_num_threads'
floatfann.c:(.text+0x1492a): undefined reference to `GOMP_parallel_start'
floatfann.c:(.text+0x14939): undefined reference to `GOMP_parallel_end'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_batch_parallel._omp_fn.0':
floatfann.c:(.text+0xf4a4): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_irpropm_parallel._omp_fn.2':
floatfann.c:(.text+0xf5f4): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_quickprop_parallel._omp_fn.4':
floatfann.c:(.text+0xf744): undefined reference to `GOMP_barrier'
/usr/local/lib/libfann.a(floatfann.c.o): In function `fann_train_epoch_sarprop_parallel._omp_fn.6':
floatfann.c:(.text+0xf894): undefined reference to `GOMP_barrier'
collect2: error: ld returned 1 exit status
make[2]: *** [FANN_sin] Error 1
make[1]: *** [CMakeFiles/FANN_sin.dir/all] Error 2
make: *** [all] Error 2
I researched the errors, and I assume they are referring GOMP, an OpenMP implementation for GCC. I currently have GCC version 4.8.4. I have the support library package libgomp1 from apt-get installed also, so I'm not sure what the problem is.
Did I miss something? Thanks.

GLFW3 - Undefined reference to XRR

I am trying to compile a very simple OpenGL program that uses GLFW3. Despite linking everything I deem necessary, I'm getting a plethora of undefined references.
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwInitGammaRamp':
x11_gamma.c:(.text+0x49): undefined reference to `XRRGetScreenResources'
x11_gamma.c:(.text+0x6a): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0x81): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformGetGammaRamp':
x11_gamma.c:(.text+0xce): undefined reference to `XRRGetCrtcGammaSize'
x11_gamma.c:(.text+0xf1): undefined reference to `XRRGetCrtcGamma'
x11_gamma.c:(.text+0x198): undefined reference to `XRRFreeGamma'
/usr/local/lib/libglfw3.a(x11_gamma.c.o): In function `_glfwPlatformSetGammaRamp':
x11_gamma.c:(.text+0x24c): undefined reference to `XRRAllocGamma'
x11_gamma.c:(.text+0x303): undefined reference to `XRRSetCrtcGamma'
x11_gamma.c:(.text+0x30f): undefined reference to `XRRFreeGamma'
/usr/local/lib/libglfw3.a(x11_init.c.o): In function `initExtensions':
x11_init.c:(.text+0x1a67): undefined reference to `XRRQueryExtension'
x11_init.c:(.text+0x1a91): undefined reference to `XRRQueryVersion'
x11_init.c:(.text+0x1b25): undefined reference to `XIQueryVersion'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwSetVideoMode':
x11_monitor.c:(.text+0x177): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x19c): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x1be): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x3d0): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x3dc): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x3e8): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x3f4): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwRestoreVideoMode':
x11_monitor.c:(.text+0x446): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x46b): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x4e0): undefined reference to `XRRSetCrtcConfig'
x11_monitor.c:(.text+0x4ec): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x4f8): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitors':
x11_monitor.c:(.text+0x55a): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x577): undefined reference to `XRRGetOutputPrimary'
x11_monitor.c:(.text+0x5cf): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x5ea): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x659): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0x676): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x682): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x703): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0x70f): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x733): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetMonitorPos':
x11_monitor.c:(.text+0x8a2): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x8c7): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0x8ff): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0x90b): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoModes':
x11_monitor.c:(.text+0x9ad): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0x9cf): undefined reference to `XRRGetOutputInfo'
x11_monitor.c:(.text+0xb44): undefined reference to `XRRFreeOutputInfo'
x11_monitor.c:(.text+0xb50): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_monitor.c.o): In function `_glfwPlatformGetVideoMode':
x11_monitor.c:(.text+0xc28): undefined reference to `XRRGetScreenResources'
x11_monitor.c:(.text+0xc4d): undefined reference to `XRRGetCrtcInfo'
x11_monitor.c:(.text+0xca2): undefined reference to `XRRFreeCrtcInfo'
x11_monitor.c:(.text+0xcae): undefined reference to `XRRFreeScreenResources'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `createWindow':
x11_window.c:(.text+0x666): undefined reference to `XISelectEvents'
x11_window.c:(.text+0x6a8): undefined reference to `XRRSelectInput'
/usr/local/lib/libglfw3.a(x11_window.c.o): In function `processEvent':
x11_window.c:(.text+0x1711): undefined reference to `XRRUpdateConfiguration'
My linked CMake flags:
-I/usr/local/include -L/usr/local/lib -lglfw3 -lGLU -lGL -lGLEW
Should I be linking anything else?
I figured out the answer myself while writing the question.
I was misled into believing that I was linking everything necessary because of the output of
pkg-config --libs --cflags --print-requires glfw3
which was
-I/usr/local/include -L/usr/local/lib -lglfw3
The --print-requires flag was having no impact at all on the output, which seemed odd. I searched and printed the corresponding .pc file.
sudo find / | grep "glfw3\.pc"
cat /usr/local/lib/pkgconfig/glfw3.pc
There I found this.
Requires.private: x11 xrandr xi xxf86vm gl
Which indicates which libraries are required for static linking. I added their correponding flags to CMake and it worked. My mistake was that I missed the --print-requires-private flag when executing pkg-config.
I hope this helps someone save some time.

undefined reference to `inflate'

Trying to link against a static assimp library which I built with MinGW. Here are the errors I'm getting:
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xd91):
undefined reference to inflateInit2_'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xe06):
undefined reference toinflate'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(BlenderLoader.cpp.obj):BlenderLoader.cpp:(.text+0xf72):
undefined reference to inflateEnd'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x76c):
undefined reference toinflateInit2_'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x7ff):
undefined reference to inflate'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XGLLoader.cpp.obj):XGLLoader.cpp:(.text+0x953):
undefined reference toinflateEnd'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x9ac):
undefined reference to inflateInit2_'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xd5c):
undefined reference toinflate'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xed2):
undefined reference to inflateReset'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xef8):
undefined reference toinflateSetDictionary'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0xf52):
undefined reference to inflateEnd'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x1b4a):
undefined reference toinflateInit2_'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x1efa):
undefined reference to inflate'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x2070):
undefined reference toinflateReset'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x2096):
undefined reference to inflateSetDictionary'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(XFileParser.cpp.obj):XFileParser.cpp:(.text+0x20f0):
undefined reference toinflateEnd'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1935):
undefined reference to inflateInit2_'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x19b8):
undefined reference toget_crc_table'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1ec2):
undefined reference to crc32'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1f67):
undefined reference toinflate'
H:\ovgl\ovgl...\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x1fb5):
undefined reference to crc32'
H:\ovgl\ovgl\.\..\dependencies\Assimp\lib\libassimp.a(unzip.c.obj):unzip.c:(.text+0x2245):
undefined reference toinflateEnd'
Those are functions in the zlib library. Do you have zlib.h and the zlib library (.a or .lib) and the paths set correctly

How to compile Botan and Qt on Windows?

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