lundi 3 octobre 2016

Linking errors with SQLAPI++

#include <SQLAPI.h> // main SQLAPI++ header

int main(int argc, char* argv[]){
    SAConnection con; // create connection object
}

I'm following the online guide as it suggests:

http://ift.tt/2dTZ4g0

Programmers need to include the SQLAPI++ header files. Those with a command-line compiler will typically use options such as '/I%SQLAPIDIR%\include' or '-I${SQLAPIDIR}/include'. The header files are in the include subdirectory of SQLAPI++ distributions:

#include - main header, should be used whenever SQLAPI++ is used.

and

Programmers need to link with static or dynamic libraries. Those with a command-line compiler will typically use options such as '/L%SQLAPIDIR%\lib sqlapi.lib' or 'or -L${SQLAPIDIR}/lib -lsqlapi'. The libraries are in the lib subdirectory of SQLAPI++ distributions:

libsqlapi.a - for linking with release version of static library (MinGW)

I have downloaded the version for Windows and I'm using g++ (x86_64-posix-seh, Built by MinGW-W64 project) 6.1.0. The download section is clear that there are compiled files for MinGW g++ 5.1 for x86-64. But I keep receiving the linker error:

g++ main.cpp -std=c++11 -Iinclude/SQLAPI/include/ -Linclude/SQLAPI/lib -lsqlapi

C:\%USERPATH%\cc9v656d.o:main.cpp:(.text+0x1c): undefined reference to `SAConnection::SAConnection()'

C:\%USERPATH%\cc9v656d.o:main.cpp:(.text+0x28): undefined reference to `SAConnection::~SAConnection()'

collect2.exe: error: ld returned 1 exit status

I am linking libsqlapi.a exactly as it says and including the directory for the header, so why am I running in to linking errors? I would recompile the files myself as the manual indicates to do, but it says the appropriate batch files are in the src subdirectory, and if you download the file yourself you see that there is no such directory provided.

Aucun commentaire:

Enregistrer un commentaire