Use a third party library in C++ Windows MSVC

0

I am kind of a newbie in C++. I am struggling using a third party library. I am sorry if this sounds obvious to many. However, if anyone could help that would be nice.

Thanks a lot

I am trying to compile and use a third party library called XXXX. So I followed the instruction to compile XXXX. It compiled fine using Visual Studio 2019 16.5.

The library file is in:

  • D:\Workspace\XXXX\build\src\C++\Debug\XXXXd.lib
  • D:\Workspace\XXXX\build\src\C++\Debug\XXXX.lib (I copied the dedbug file without the suffix "d"...)
  • D:\Workspace\XXXX\build\src\C++\Release\XXXX.lib

I am getting the following error:

NMAKE : fatal error U1073: don't know how to make 'XXXX.lib'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.

Using this cmake file

cmake_minimum_required(VERSION 3.10)
project(Ahahah)

set(CMAKE_CXX_STANDARD 17)
add_compile_definitions(HAVE_STD_UNIQUE_PTR=1)
add_compile_definitions(_HAS_AUTO_PTR_ETC=1)


INCLUDE_DIRECTORIES(D:/Workspace/XXXX/include)
link_directories(D:/Workspace/XXXX/build/src/C++/Debug)
add_library(XXXX STATIC D:/Workspace/XXXX/build/src/C++/Debug)
set_target_properties(XXXX PROPERTIES LINKER_LANGUAGE CXX)

add_executable(Ahahah
        Ahahah/src/Common/CommandLineConsole/Command.cpp
        Ahahah/src/Common/CommandLineConsole/Command.h)
target_link_libraries(Ahahah PUBLIC XXXX)

If I comment out add_library and set_target_properties, with this cmake:

cmake_minimum_required(VERSION 3.10)
project(Ahahah)

set(CMAKE_CXX_STANDARD 17)
add_compile_definitions(HAVE_STD_UNIQUE_PTR=1)
add_compile_definitions(_HAS_AUTO_PTR_ETC=1)


INCLUDE_DIRECTORIES(D:/Workspace/XXXX/include)
link_directories(D:/Workspace/XXXX/build/src/C++/Debug)


add_executable(Ahahah
        Ahahah/src/Common/CommandLineConsole/Command.cpp
        Ahahah/src/Common/CommandLineConsole/Command.h)
target_link_libraries(Ahahah PUBLIC XXXX)

I get this error

lgo2.exe : fatal error LNK1120: 23 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2019.3.5\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\HostX86\x64\nmake.exe"' : return code '0x2'
Stop.
c++
windows
cmake
clion
linkage
asked on Stack Overflow May 2, 2020 by Mr_Kaz • edited May 2, 2020 by Mr_Kaz

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0