SQLAPI++ under CLion

308 Views Asked by At

I'm currently learning c++ and wanted to try something with Databases and ran into SQLAPI++. As I like the IDEs of JetBrains I use CLion. As a compiler I started using the Cygwin compiler and donwloaded the Visual Studio Compiler this week to get SQLAPI++ working. So finally feeling ready like compiling would work now, I get linking errors.

NMAKE : fatal error U1077: ""C:\Program Files\JetBrains\CLion 2021.1.3\bin\cmake\win\bin\cmake.exe"": Exit-Code "0xffffffff"
Stop.
NMAKE : fatal error U1077: ""E:\Programs\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"": Exit-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""E:\Programs\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"": Exit-Code "0x2"
Stop.
NMAKE : fatal error U1077: ""E:\Programs\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x86\nmake.exe"": Exit-Code "0x2"
Stop.

sqlapis.lib(samisc.obj) : error LNK2019: Reference to non listed extern Symbol "_GetFileVersionInfoSizeA@8" in function ""void * __cdecl SAGetVersionInfo(char const *)" (?SAGetVersionInfo@@YAPAXPBD@Z)".
sqlapis.lib(samisc.obj) : error LNK2019: Reference to non listed extern Symbol "_GetFileVersionInfoA@16" in function ""void * __cdecl SAGetVersionInfo(char const *)" (?SAGetVersionInfo@@YAPAXPBD@Z)".
sqlapis.lib(samisc.obj) : error LNK2019: Reference to non listed extern Symbol "_VerQueryValueA@16" in function ""long __cdecl SAGetFileVersionFromString(char const *)" (?SAGetFileVersionFromString@@YAJPBD@Z)".

Here's my CMakeLists:

cmake_minimum_required(VERSION 3.19)
project(Project)

set(CMAKE_CXX_STANDARD 20)
set(Boost_USE_STATIC_LIBS OFF)
set(LIBS "C:/Users/Maximilian/Documents/C C++/librarys")

include_directories(Project ${LIBS}/SQLAPI/include/)

add_executable(Project main.cpp src/Project.cpp src/Project.h)

target_link_libraries(Project ${LIBS}/SQLAPI/vs2019/lib/sqlapis.lib)
target_link_libraries(Project ${LIBS}/SQLAPI/vs2019/lib/sqlapisd.lib)

And here's the example code I copied:

#include <iostream>
#include <SQLAPI.h>

int main(int argc, char* argv[])
{
    SAConnection saConnection;


    try {
        saConnection.Connect(_TSA("localhost:3306"), _TSA("MaxBas"), _TSA("maxi2004"));
        printf("We are connected!\n");

        saConnection.Disconnect();
        printf("We are disconnected!\n");
    }
    catch(SAException &x) {
        saConnection.Rollback();
        printf("%s\n", x.ErrText().GetMultiByteChars());
    }

    return 0;
}
0

There are 0 best solutions below