将sfml-vscode-boilerplate与imgui集成
我跟随此 tutorial 以便将imgui与 sfml-vscode-boilerplate 在VSCODE(MACOS)上。但是,此视频是关于在Visual Studio中将IMGUI与SFML集成。因此,我无法重复该视频中的每个过程。
当我通过按Ctrl+Shift+B执行程序时,然后单击构建&运行调试选项,我得到了此 error
⬤ Build & Run: Debug (target: IMGUISFML)
⇛ Linking: bin/Debug/IMGUISFMLUndefined symbols for architecture x86_64:
"ImGui::End()", referenced from:
_main in Main.cpp.o
"ImGui::SFML::ProcessEvent(sf::Window const&, sf::Event const&)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Render(sf::RenderWindow&)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Update(sf::RenderWindow&, sf::Time)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Shutdown()", referenced from:
_main in Main.cpp.o
"ImGui::Begin(char const*, bool*, int)", referenced from:
_main in Main.cpp.o
"ImGui::Button(char const*, ImVec2 const&)", referenced from:
_main in Main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/Debug/IMGUISFML] Error 1
make: *** [all] Error 2
✘ Failed!
Review the compile errors above.
The terminal process "/bin/zsh '-c', 'bash ./build.sh buildrun Debug vscode'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
这是我的文件结构。 (此文件夹与 sfml-vscode-boilerplate ,还添加了iMgui文件夹。 )
.vscode
- _keybindings.json
- c_cpp_properties.json
- 启动
- settings.json
- tasks.json
-
内容
env
imgui
- imconfig-sfml.h
- imconfig.h
- imgui_draw.cpp
- imgui_internal.h
- imgui_tables.cpp
- imgui_widgets.cpp
- imgui-sfml_export.h
- imgui_sfml.cpp
- imgui_sfml.h
- imgui.cpp
- imgui.h
- imstb_rectpack.h
- imgstb_textedit.h
- imgstb_truetype.h
- lib
src
- 平台
- 实用程序
- main.cpp
- pch.hpp
test
.clang-format
.gitignore
build.sh
makefile
readme.md
//Here is "Main.cpp" file
#include "../imgui/imgui.h"
#include "../imgui/imgui-SFML.h"
#include "Platform/Platform.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "ImGui + SFML = <3");
window.setFramerateLimit(60);
//ImGui::SFML::Init(window);
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
sf::Clock deltaClock;
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
ImGui::SFML::ProcessEvent(window, event);
if (event.type == sf::Event::Closed) {
window.close();
}
}
ImGui::SFML::Update(window, deltaClock.restart());
ImGui::Begin("Hello, world!");
ImGui::Button("Look at this pretty button");
ImGui::End();
window.clear();
window.draw(shape);
ImGui::SFML::Render(window);
window.display();
}
ImGui::SFML::Shutdown();
}
为了将SFML与IMGUI集成在VSCODE(MACOS)上,该怎么办。另外,如果不可用IMGUI,还有其他推荐的替代C ++ GUI库吗?
感谢您阅读我的消息。
I followed this tutorial in order to use ImGui with sfml-vscode-boilerplate on VScode (macOS). However, the content of this video is about integrating ImGui with SFML in Visual Studio. So I could not repeat every process in that video.
When I executed Program by pressing Ctrl+Shift+B and click on the Build & Run Debug option, I got this error
⬤ Build & Run: Debug (target: IMGUISFML)
⇛ Linking: bin/Debug/IMGUISFMLUndefined symbols for architecture x86_64:
"ImGui::End()", referenced from:
_main in Main.cpp.o
"ImGui::SFML::ProcessEvent(sf::Window const&, sf::Event const&)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Render(sf::RenderWindow&)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Update(sf::RenderWindow&, sf::Time)", referenced from:
_main in Main.cpp.o
"ImGui::SFML::Shutdown()", referenced from:
_main in Main.cpp.o
"ImGui::Begin(char const*, bool*, int)", referenced from:
_main in Main.cpp.o
"ImGui::Button(char const*, ImVec2 const&)", referenced from:
_main in Main.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[1]: *** [bin/Debug/IMGUISFML] Error 1
make: *** [all] Error 2
✘ Failed!
Review the compile errors above.
The terminal process "/bin/zsh '-c', 'bash ./build.sh buildrun Debug vscode'" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Here is my file structure. (This folder is identical to sfml-vscode-boilerplate, except imgui folder is added.)
.vscode
- _keybindings.json
- c_cpp_properties.json
- launch.json
- settings.json
- tasks.json
bin
content
env
imgui
- imconfig-SFML.h
- imconfig.h
- imgui_draw.cpp
- imgui_internal.h
- imgui_tables.cpp
- imgui_widgets.cpp
- imgui-SFML_export.h
- imgui_SFML.cpp
- imgui_SFML.h
- imgui.cpp
- imgui.h
- imstb_rectpack.h
- imgstb_textedit.h
- imgstb_truetype.h
lib
src
- Platform
- Utility
- Main.cpp
- PCH.hpp
test
.clang-format
.gitignore
build.sh
Makefile
README.md
//Here is "Main.cpp" file
#include "../imgui/imgui.h"
#include "../imgui/imgui-SFML.h"
#include "Platform/Platform.hpp"
int main()
{
sf::RenderWindow window(sf::VideoMode(640, 480), "ImGui + SFML = <3");
window.setFramerateLimit(60);
//ImGui::SFML::Init(window);
sf::CircleShape shape(100.f);
shape.setFillColor(sf::Color::Green);
sf::Clock deltaClock;
while (window.isOpen()) {
sf::Event event;
while (window.pollEvent(event)) {
ImGui::SFML::ProcessEvent(window, event);
if (event.type == sf::Event::Closed) {
window.close();
}
}
ImGui::SFML::Update(window, deltaClock.restart());
ImGui::Begin("Hello, world!");
ImGui::Button("Look at this pretty button");
ImGui::End();
window.clear();
window.draw(shape);
ImGui::SFML::Render(window);
window.display();
}
ImGui::SFML::Shutdown();
}
What should I do in order to integrate SFML with ImGui on VScode (macOS). Also, if ImGui is not available, is there another free recommended alternative C++ GUI Library?
Thank you for reading my message.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论