CedricGuillemet / ImGuizmo

Immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui
MIT License
3.22k stars 907 forks source link

Trying to build example on Mac #290

Closed calebjacksonhoward closed 1 year ago

calebjacksonhoward commented 1 year ago

I'm trying to make the examples on a Mac, and I get the following errors. It has been more than a decade since I've worked in C++, and so I am a newb anew, in many regards. (I am also new to Mac - from a lifetime of UNIX->IRIX->Linux.). I understand the concepts well, but am out of practice, and the HW and SW has changed since I last worked with C++. Perhaps someone can give me a hint and save me some time. A quick googling isn't helping me:

Thanks

ImGuizmo % make
c++ -std=c++17 -I. -Iexample  -c -o example/main.o example/main.cpp
In file included from example/main.cpp:30:
example/ImApp.h:2838:10: error: unknown type name 'HINSTANCE'
         HINSTANCE   hInstance;
         ^
example/ImApp.h:2839:10: error: unknown type name 'HDC'
         HDC         hDC;
         ^
example/ImApp.h:2840:10: error: unknown type name 'HGLRC'
         HGLRC       hRC;
         ^
example/ImApp.h:2841:10: error: unknown type name 'HWND'
         HWND        hWnd;
         ^
example/ImApp.h:2848:14: error: unknown type name 'LRESULT'
      static LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
             ^
example/ImApp.h:2848:28: error: expected ';' at end of declaration list
      static LRESULT WINAPI WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
                           ^
                           ;
example/ImApp.h:3122:24: error: unknown type name 'LRESULT'
      static IMGUI_API LRESULT ImGui_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                       ^
example/ImApp.h:3122:53: error: unknown type name 'HWND'
      static IMGUI_API LRESULT ImGui_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                                                    ^
example/ImApp.h:3122:64: error: unknown type name 'UINT'
      static IMGUI_API LRESULT ImGui_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                                                               ^
example/ImApp.h:3122:74: error: unknown type name 'WPARAM'
      static IMGUI_API LRESULT ImGui_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                                                                         ^
example/ImApp.h:3122:89: error: unknown type name 'LPARAM'
      static IMGUI_API LRESULT ImGui_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
                                                                                        ^
example/ImApp.h:2726:28: error: use of undeclared identifier 'GetModuleHandle'
         info->hInstance = GetModuleHandle(0);
                           ^
example/ImApp.h:2728:17: error: unknown type name 'DEVMODEA'
         static DEVMODEA screenSettings = { { 0 },
                ^
example/ImApp.h:2732:77: error: unknown type name 'DWORD'
                0,0,156,0,0x001c0000,{ 0 },0,0,0,0,0,{ 0 },0,32,static_cast<DWORD>(config.mWidth), static_cast<DWORD>(config.mHeight),{ 0 }, 0,           // Visuatl Studio 2005
                                                                            ^
example/ImApp.h:2732:112: error: unknown type name 'DWORD'
                0,0,156,0,0x001c0000,{ 0 },0,0,0,0,0,{ 0 },0,32,static_cast<DWORD>(config.mWidth), static_cast<DWORD>(config.mHeight),{ 0 }, 0,           // Visuatl Studio 2005
                                                                                                               ^
example/ImApp.h:2743:79: error: use of undeclared identifier 'CDS_FULLSCREEN'
            if (config.mFullscreen && ChangeDisplaySettingsA(&screenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
                                                                              ^
example/ImApp.h:2743:98: error: use of undeclared identifier 'DISP_CHANGE_SUCCESSFUL'
            if (config.mFullscreen && ChangeDisplaySettingsA(&screenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
                                                                                                 ^
example/ImApp.h:2749:15: error: use of undeclared identifier 'WindowInit'
         if (!WindowInit(info))
              ^
example/ImApp.h:2751:13: error: use of undeclared identifier 'WindowEnd'
            WindowEnd(info);
            ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make: *** [example/main.o] Error 1
CedricGuillemet commented 1 year ago

The sample is for Windows only. If you want to have the samples on Linux or MacOS, you'll need to add support for other windowing system/inputs. Another possibility is to use a 3rd party library like SDL for GLFW just like Dear Imgui.

calebjacksonhoward commented 1 year ago

Then I tried building on Windows, but couldn't get an env configured for make, nor cmake.

CedricGuillemet commented 1 year ago

There is a visual studio project : https://github.com/CedricGuillemet/ImGuizmo/blob/master/example/ImGuizmoSample.vcxproj

calebjacksonhoward commented 1 year ago

Perfect. Thanks. I don't generally have to deal with Windows. I am unused to the requirement of a specific proprietary IDE to build code. I appreciate the pointer.