Перешел из раздела консольных приложений в графические. Выбрал ImGui. Установил с vcpkg (указав dcmake toolchain с cmake toolchain на нужные папки в vcpkg. Сам CLion ошибки при написании не выдает, но при компиляции получается вот какая ошибка:
[1/2] Building CXX object CMakeFiles/ImguiTest.dir/main.cpp.obj
[2/2] Linking CXX executable ImguiTest.exe
FAILED: ImguiTest.exe
cmd.exe /C "cd . && C:\PROGRA~1\JETBRA~1\CLION2~1.4\bin\mingw\bin\G__~1.EXE -g CMakeFiles/ImguiTest.dir/main.cpp.obj -o ImguiTest.exe -Wl,--out-implib,libImguiTest.dll.a -Wl,--major-image-version,0,--minor-image-version,0 C:/tools/vcpkg/installed/x64-windows/debug/lib/imguid.lib -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cmd.exe /C "cd /D C:\Users\ermak\CLionProjects\ImguiTest\cmake-build-debug && C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -noprofile -executionpolicy Bypass -file C:/tools/vcpkg/scripts/buildsystems/msbuild/applocal.ps1 -targetBinary C:/Users/ermak/CLionProjects/ImguiTest/cmake-build-debug/ImguiTest.exe -installedDir C:/tools/vcpkg/installed/x64-windows/debug/bin -OutVariable out""
C:\Program Files\JetBrains\CLion 2023.3.4\bin\mingw\bin/ld.exe: CMakeFiles/ImguiTest.dir/main.cpp.obj: in function `main':
C:/Users/ermak/CLionProjects/ImguiTest/main.cpp:13: undefined reference to `ImGui::Text(char const*, ...)'
C:\Program Files\JetBrains\CLion 2023.3.4\bin\mingw\bin/ld.exe: C:/Users/ermak/CLionProjects/ImguiTest/main.cpp:14: undefined reference to `ImGui::Button(char const*, ImVec2 const&)'
C:\Program Files\JetBrains\CLion 2023.3.4\bin\mingw\bin/ld.exe: C:/Users/ermak/CLionProjects/ImguiTest/main.cpp:18: undefined reference to `ImGui::InputText(char const*, char*, unsigned long long, int, int (*)(ImGuiInputTextCallbackData*), void*)'
C:\Program Files\JetBrains\CLion 2023.3.4\bin\mingw\bin/ld.exe: C:/Users/ermak/CLionProjects/ImguiTest/main.cpp:20: undefined reference to `ImGui::SliderFloat(char const*, float*, float, float, char const*, int)'
C:\Program Files\JetBrains\CLion 2023.3.4\bin\mingw\bin/ld.exe: C:/Users/ermak/CLionProjects/ImguiTest/main.cpp:21: undefined reference to `ImGui::Button(char const*, ImVec2 const&)'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
Так же прикладываю конфик симейка и файл мейн:
cmake_minimum_required(VERSION 3.27)
set(CMAKE_TOOLCHAIN_FILE C:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake)
set(CMAKE_CXX_STANDARD 23)
project(ImguiTest)
add_executable(ImguiTest main.cpp)
find_package(imgui CONFIG REQUIRED)
target_link_libraries(ImguiTest PRIVATE imgui::imgui)
#include <iostream>
#include <imgui.h>
int MySaveFunction() {
std::cout << "Saved" << std::endl;
return 0;
}
int main() {
std::cout << "Hello, World!" << std::endl;
ImGui::Text("Hello, world %d", 123);
if (ImGui::Button("Save"))
MySaveFunction();
char buf[128] = {0};
float f = 0.0f;
ImGui::InputText("string", buf, IM_ARRAYSIZE(buf));
std::string data(buf);
ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
if (ImGui::Button("Print")) {
std::cout << buf << " " << f << std::endl;
}
return 0;
}
Меня забанили в гугле (по моему запросу всего 6 результатов). Помогите решить!