Open prlw1 opened 3 years ago
It seems there's a missing #if defined (_WIN32)
(I'm not on windows)
Have you solved this issue?
Better is the enemy of good... This was all I needed to get over the above problem:
diff --git a/common/App.cpp b/common/App.cpp
index 15670b9..e659512 100644
--- a/common/App.cpp
+++ b/common/App.cpp
@@ -149,7 +149,9 @@ App::App(std::string title, int w, int h, int argc, char const *argv[])
const bool no_vsync = result["vsync"].as<bool>();
const bool use_msaa = result["msaa"].as<bool>();
const bool im_style = result["imgui"].as<bool>();
+#if defined(_WIN32)
NvOptimusEnablement = AmdPowerXpressRequestHighPerformance = result["gpu"].as<bool>();
+#endif
#ifdef _DEBUG
title += " - OpenGL - Debug";
@@ -317,4 +319,4 @@ ImVec2 App::GetWindowSize() const
int w, h;
glfwGetWindowSize(Window, &w, &h);
return ImVec2(w, h);
-}
\ No newline at end of file
+}
I then hit further issues I hoped to make a patch for, but those are probably local to my build environment...
I was abble to build the project on macos without issues.. if you want some help let me know.
Can confirm adding #if defined(_WIN32) just before line 152 (where NvOptimusEnablement variable is used), and the #endif right after it, fixed the compilation error.
But then I get stuck with ld: cannot find -limm32 error at the linking stage for the spectogram app. I'm on Ubuntu 20.04.
Tried some google searches and couldn't find how I can get imm32 lib added to Ubuntu...
Hey @rmaia3d, just change the CmakeLists:
from this:
target_link_libraries(imgui PUBLIC glfw glad OpenGL::GL imm32)
to this:
if (WIN32)
target_link_libraries(imgui PUBLIC glfw glad OpenGL::GL imm32)
else()
target_link_libraries(imgui PUBLIC glfw glad OpenGL::GL)
endif()
and at the beginning of the file from this:
cmake_minimum_required(VERSION 3.0.0)
project(implot_demos VERSION 0.1.0)
to this:
cmake_minimum_required(VERSION 3.0.0)
project(implot_demos VERSION 0.1.0)
set(CMAKE_CXX_STANDARD 17)
add_compile_options(-O3 -march=native)
this way I was able to build for mac and windows as well.
I don't know if the architecture flag is needed for you but, as I'm on a macOS, it was needed.
Thanks a lot @tatolevicz !!
Making the changes you suggested to the CMakeLists.txt file did it! I was able to compile succesfully all the demos, albeit with some deprecated warnings. But no errors.
I also tested not including the -march flag, and in Ubuntu it also threw compilation errors. So seems like that flag is indeed needed for non-Win32 platforms...
I'm glad to help you @rmaia3d ! Have a nice new year = ).
@tatolevicz Thank you very much!! Happy 2022 to you too! :-)
Can confirm that as of today, this build error (and the imm32 error) still exist on Lubuntu 20.04. But the fixes above to App.cpp and the CMakeLists also still work.
Confirm that @rmaia3d fix resolves this still existing build issue on ubuntu 2210.
Thanks for the response! I'm also a ubuntu 22 user. 5 binary files (demo, graph, mandel, maps and perlin
) are successfully built in the demos
, but filter
got a problem:
mplot/implot_demos/demos/filter.cpp: In member function ‘virtual void ImFilter::Update()’:
/home/tim/c/implot/implot_demos/demos/filter.cpp:73:51: error: ‘GetWindowContentRegionWidth’ is not a member of ‘ImGui’; did you mean ‘GetWindowContentRegionMin’?
73 | ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, -1));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
| GetWindowContentRegionMin
make[2]: *** [CMakeFiles/filter.dir/build.make:76: CMakeFiles/filter.dir/demos/filter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:878: CMakeFiles/filter.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
Does anyone have an idea on how to fix it?
@mithgil
ImGui::GetWindowContentRegionWidth
was deprecated and needs to be replaced with GetWindowContentRegionMax().x - GetWindowContentRegionMin().x
.
You need to update demos/filter.cpp:73
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionWidth() * 0.5f, -1));
becomes
ImGui::BeginChild("ChildL", ImVec2(ImGui::GetWindowContentRegionMax().x - ImGui::GetWindowContentRegionMin().x * 0.5f, -1));
https://github.com/ocornut/imgui/blob/master/docs/CHANGELOG.txt#L882-L883 I find it strange that such a handy utility method would be deprecated :thinking: but here we are
Just tried to build with today's git head of imgui/implot/implot_demos with gcc 10.3.0 and see: