pthom / hello_imgui

Hello, Dear ImGui: unleash your creativity in app development and prototyping
https://pthom.github.io/hello_imgui
MIT License
607 stars 91 forks source link

Errors when build for Emscripten with-DHELLOIMGUI_USE_SDL_OPENGL3=ON #8

Closed alanyangbo closed 3 years ago

alanyangbo commented 3 years ago

The signature of Demo main() function is exactly int main(int argc, char **argv) and returns an int. //----------------------------- 37>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 37>C:\GUI\Imgui\hello_imgui-master\build_emscripten\src\hello_imgui_demos\hello_imgui_demo_minimal\Debug\hello_imgui_demo_minimal.exe : fatal error LNK1120: 1 unresolved externals 39>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 39>C:\GUI\Imgui\hello_imgui-master\build_emscripten\src\hello_imgui_demos\hello_world\Debug\hello_world.exe : fatal error LNK1120: 1 unresolved externals 40>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol main referenced in function "int cdecl invoke_main(void)" (?invoke_main@@YAHXZ) 40>C:\GUI\Imgui\hello_imgui-master\build_emscripten\src\hello_imgui_demos\hello_imgui_demo_classic\Debug\hello_imgui_demo_classic.exe : fatal error LNK1120: 1 unresolved externals

pthom commented 3 years ago

Hello,

It seems that there is an issue in the way you are invoking emscripten and that your issue is related to "MSVC / Windows" , since the message "MSVCRTD.lib" show that you are linking against "Microsoft Visual Studio RunTime Debug Library" (MSVCRTD.lib).

When building with emscripten, the msvc compiler and the msvc runtime should not be used: instead you use a compiler provided by emscripten (which is based on clang).

The readme provides instructions for emscripten builds under linux or osx. I just tried them and they do work. However, I did not try them under windows.

Suggestions:

Good luck

alanyangbo commented 3 years ago

Hello,

It seems that there is an issue in the way you are invoking emscripten and that your issue is related to "MSVC / Windows" , since the message "MSVCRTD.lib" show that you are linking against "Microsoft Visual Studio RunTime Debug Library" (MSVCRTD.lib).

When building with emscripten, the msvc compiler and the msvc runtime should not be used: instead you use a compiler provided by emscripten (which is based on clang).

The readme provides instructions for emscripten builds under linux or osx. I just tried them and they do work. However, I did not try them under windows.

Suggestions:

Good luck

alanyangbo commented 3 years ago

Thanks a lot.