floooh / cimgui-sokol-starterkit

A minimal self-contained Dear ImGui starter project for Windows, Linux and macOS.
MIT License
213 stars 19 forks source link

Defaulting to D3D on windows + gcc #1

Open JettMonstersGoBoom opened 3 years ago

JettMonstersGoBoom commented 3 years ago

Line 5 of sokol.c

define SOKOL_D3D11

doesn't build with GCC.

define SOKOL_GLCORE33

worked fine for me.

saucesaft commented 3 years ago

Had the same problem, im compilling it on mingw64. Maybe adding the following to sokol/sokol.c could work:

#if defined(__MINGW32__)
#define SOKOL_GLCORE33
beetaa commented 1 year ago

Had the same problem, im compilling it on mingw64. Maybe adding the following to sokol/sokol.c could work:

#if defined(__MINGW32__)
#define SOKOL_GLCORE33

thank you for the answer, I adjust by the hint and modify sokol/sokol.c as:

// sokol implementation library on non-Apple platforms
#define SOKOL_IMPL
#if defined(__MINGW32__)
#define SOKOL_GLCORE33
#elif defined(_WIN32)
#define SOKOL_D3D11
#elif defined(__EMSCRIPTEN__)
#define SOKOL_GLES2
#elif defined(__APPLE__)
// NOTE: on macOS, sokol.c is compiled explicitely as ObjC
#define SOKOL_METAL
#else
#define SOKOL_GLCORE33
#endif
#include "sokol_app.h"
#include "sokol_gfx.h"
#include "sokol_glue.h"
#define CIMGUI_DEFINE_ENUMS_AND_STRUCTS
#include "cimgui.h"
#define SOKOL_IMGUI_IMPL
#include "sokol_imgui.h"

complie and link success. hope helps.