Linux only G++ Error: ImVec4

Hi, I’m trying to compile my code in Ubuntu 18.04 (x64) using G++.
This code runs perfect on Visual Studio 2019, but I some errors in Linux only.

ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::ImColor(10.0f, 0.0f, 0.0f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::ImColor(50.0f, 0.0f, 0.0f));
ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::ImColor(200.0f, 0.0f, 

Compile erros (ImVec4):

error: cannot call constructor ‘ImColor::ImColor’ directly [-fpermissive]
ImGui::PushStyleColor(ImGuiCol_Button, (ImVec4)ImColor::ImColor(10.0f, 0.0f, 0.0f));
                                                                             
rtt_gui.cpp:190:85: note: for a function-style cast, remove the redundant ‘::ImColor’
rtt_gui.cpp:191:92: error: cannot call constructor ‘ImColor::ImColor’ directly [-fpermissive]
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, (ImVec4)ImColor::ImColor(50.0f, 0.0f, 0.0f));
                                                                                        
rtt_gui.cpp:191:92: note: for a function-style cast, remove the redundant ‘::ImColor’
rtt_gui.cpp:192:92: error: cannot call constructor ‘ImColor::ImColor’ directly [-fpermissive]
ImGui::PushStyleColor(ImGuiCol_ButtonActive, (ImVec4)ImColor::ImColor(200.0f, 0.0f, 0.0f));

I don’t think that’s valid C++, you should just use ImColor(10.0f, 0.0f, 0.0f, 0.0f) without a ImColor:: prefix, exactly like the error says…

1 Like

Thank you so much!
I fixed this problem!