You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to build in msvc 2019 and got an error: Error LNK2019 unresolved external symbol "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ
I got tired of suffering with the CMAKE config in VS and I tried to build using MSYS2 (with mingw compiler), after agonizing over there, I ended up with a similar problem undefined reference to 'WinMain'
in the end, it was necessary to add #define SDL_MAIN_HANDLED (before #include <GL/glew.h>) to export.cpp and then it compiled!
You also need to install mingw-w64-x86_64-cmake and don't use the default cmake from msys2 (remove it and restart ) otherwise you won't get past the Could NOT find OpenGL error (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY) even if you install mingw64/mingw-w64-x86_64-mesa.
I was also able to build without any cmake this way: g++.exe -mwindows export.cpp -o export.exe -lmingw32 -lsdl2 -lopengl32 -lglu32 -lglew32
I also had to comment: glUniform4fv(glGetUniformLocation(Image_SP, "iMouse"), 1, glm::value_ptr(shaderVariable));
because it couldn't defined shaderVariable: error: 'shaderVariable' was not declared in this scope.
Some tips
For static build (no need lib*.dll but need put SDL2.dll and glew32.dll in exe folder):
Add in CMakeLists.txt -static by replace target_link_libraries(ShaderProject GLEW::GLEW SDL2::SDL2)
to target_link_libraries(ShaderProject GLEW::GLEW SDL2::SDL2 -static)
Compile without console window:
Replace in CMakeLists.txt add_executable(ShaderProject ${SOURCES})
to add_executable(ShaderProject WIN32 ${SOURCES})
For beginners: cmake . && cmake --build . for configure and build by cmake
You need to install glew sdl2 glm packages via pacman -S packagename (use search via pacman -Ss packagename).
The text was updated successfully, but these errors were encountered:
It's pretty strange you want to compile w/o cmake when cmake output is explicitly what the export generates, then complain it's hard. :-) Thanks for documenting how to do it for the curious though!
First of all, thanks for such a cool editor!
I tried to build in msvc 2019 and got an error:
Error LNK2019 unresolved external symbol "int __cdecl invoke_main(void)" (?invoke_main@@YAHXZ
I got tired of suffering with the CMAKE config in VS and I tried to build using MSYS2 (with mingw compiler), after agonizing over there, I ended up with a similar problem
undefined reference to 'WinMain'
in the end, it was necessary to add
#define SDL_MAIN_HANDLED
(before#include <GL/glew.h>
) to export.cpp and then it compiled!You also need to install
mingw-w64-x86_64-cmake
and don't use the default cmake from msys2 (remove it and restart ) otherwise you won't get past theCould NOT find OpenGL error (missing: OPENGL_opengl_LIBRARY OPENGL_glx_LIBRARY)
even if you installmingw64/mingw-w64-x86_64-mesa
.I was also able to build without any cmake this way:
g++.exe -mwindows export.cpp -o export.exe -lmingw32 -lsdl2 -lopengl32 -lglu32 -lglew32
I also had to comment:
glUniform4fv(glGetUniformLocation(Image_SP, "iMouse"), 1, glm::value_ptr(shaderVariable));
because it couldn't defined
shaderVariable
:error: 'shaderVariable' was not declared in this scope
.Some tips
For static build (no need lib*.dll but need put SDL2.dll and glew32.dll in exe folder):
Add in CMakeLists.txt
-static
by replacetarget_link_libraries(ShaderProject GLEW::GLEW SDL2::SDL2)
to
target_link_libraries(ShaderProject GLEW::GLEW SDL2::SDL2 -static)
Compile without console window:
Replace in CMakeLists.txt
add_executable(ShaderProject ${SOURCES})
to
add_executable(ShaderProject WIN32 ${SOURCES})
For beginners:
cmake . && cmake --build .
for configure and build by cmakeYou need to install glew sdl2 glm packages via
pacman -S packagename
(use search viapacman -Ss packagename
).The text was updated successfully, but these errors were encountered: