When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
12 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
code
cmake_minimum_required(VERSION 3.26.4)
project(discord_bot)
# Find the required package
find_package(dpp CONFIG REQUIRED)
find_library(QIC_DATABASE_LIB NAMES libQic_database PATHS C:/Users/rober/CLionProjects/windows-bot-template)
link_directories(${CMAKE_SOURCE_DIR})
# Define the target
add_executable(discord_bot main.cpp
main.cpp
Qic_database.h
)
# Link libraries to the target
target_link_libraries(discord_bot ${QIC_DATABASE_LIB})
target_link_libraries(discord_bot dpp::dpp)
# Specify the include directories for the target
target_include_directories(discord_bot PRIVATE "C:/Users/rober/OneDrive/Desktop/cpp/utility/vcpkg/installed/x64-windows/include")
folder structure:
----(project folder)
---CMakeList.txt
---libQic_database.a
---Qic_database.h
---main.cpp
allright
it seems that the error changed?
cmd.exe /C "cd . && "C:\Program Files\JetBrains\CLion 2023.2.2\bin\cmake\win\x64\bin\cmake.exe" -E vs_link_exe --intdir=CMakeFiles\discord_bot.dir --rc=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\rc.exe --mt=C:\PROGRA~2\WI3CF2~1\10\bin\100226~1.0\x64\mt.exe --manifests -- C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\discord_bot.dir\main.cpp.obj /out:discord_bot.exe /implib:discord_bot.lib /pdb:discord_bot.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console -LIBPATH:C:\Users\rober\CLionProjects\windows-bot-template C:\Users\rober\CLionProjects\windows-bot-template\libQic_database.a C:\Users\rober\OneDrive\Desktop\cpp\utility\vcpkg\installed\x64-windows\lib\dpp.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib && cmd.exe /C "cd /D C:\Users\rober\CLionProjects\windows-bot-template\cmake-build-release-vs && "C:\Program Files\PowerShell\7\pwsh.exe" -noprofile -executionpolicy Bypass -file C:/Users/rober/OneDrive/Desktop/cpp/utility/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/rober/CLionProjects/windows-bot-template/cmake-build-release-vs/discord_bot.exe -installedDir C:/Users/rober/OneDrive/Desktop/cpp/utility/vcpkg/installed/x64-windows/bin -OutVariable out""
LINK: command "C:\PROGRA~1\MIB055~1\2022\COMMUN~1\VC\Tools\MSVC\1437~1.328\bin\Hostx64\x64\link.exe /nologo CMakeFiles\discord_bot.dir\main.cpp.obj /out:discord_bot.exe /implib:discord_bot.lib
/pdb:discord_bot.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:console -LIBPATH:C:\Users\rober\CLionProjects\windows-bot-template C:\Users\rober\CLionProjects\windows-bot-template\libQic_database.a C:\Users\rober\OneDrive\Desktop\cpp\utility\vcpkg\installed\x64-windows\lib\dpp.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:discord_bot.exe.manifest" failed (exit code 1120) with the following output:
main.cpp.obj : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
Creating library discord_bot.lib and object discord_bot.exp
main.cpp.obj : error LNK2001: unresolved external symbol "public: enum qic::Result __cdecl qic::DataBase::createTable(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::vector<enum qic::dataType,class std::allocator<enum qic::dataType> >)" (?createTable@DataBase@qic@@QEAA?AW4Result@2@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$vector@W4dataType@qic@@V?$allocator@W4dataType@qic@@@std@@@5@@Z)
main.cpp.obj : error LNK2001: unresolved external symbol "public: __cdecl qic::DataBase::DataBase(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (??0DataBase@qic@@QEAA@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
discord_bot.exe : fatal error LNK1120: 2 unresolved externals
ninja: build stopped: subcommand failed.
OK
so
basaically it cant find the definition of the methods in the .a file???
@bronze onyx
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.
!solved