Skip to content

How to build on Windows? #429

@danieldownes

Description

@danieldownes

I installed msys from https://www.msys2.org/

I admit I am a noob when it comes to mingw and gcc, although I use C++ professionally (Visual Studio).

With a fresh install on Windows 11, the Windows instructions do not work out the box.

I tried installing some prerequests by performing
pacman -Syu
(then restart the msys2)
pacman -Su

I get:
src/utils/gl.h:37:14: fatal error: GL/glew.h: No such file or directory 37 | # include "GL/glew.h"
` ...

I checked with Claude, and it suggested installing these too:
pacman -S mingw-w64-x86_64-glew pacman -S mingw-w64-x86_64-mesa
pacman -S mingw-w64-x86_64-freeglut pacman -S mingw-w64-x86_64-glm

I then get this (I cut it down a bit):

g++ -o goxel.exe -Wl,-no-undefined --static src/action.o src/assets.o src/camera.o src/file_format.o src/filters.o src/filters/colors.o src/filters/mirror.o src/filters/wrap.o src/formats/gltf.o src/formats/gox.o src/formats/luanti.o src/formats/png.o src/formats/png_slices.o src/formats/povray.o src/formats/qubicle.o src/formats/qubicle2.o src/formats/txt.o src/formats/vox.o src/formats/voxlap.o src/formats/vxl.o src/formats/wavefront.o src/gesture.o src/gesture3d.o src/gizmos.o src/goxel.o src/gui.o src/gui/about.o src/gui/app.o src/gui/cameras_panel.o src/gui/debug_panel.o src/gui/edit_panel.o src/gui/export_panel.o src/gui/image_panel.o src/gui/layers_panel.o src/gui/light_panel.o src/gui/material_panel.o src/gui/menu.o src/gui/palette_panel.o src/gui/quit.o src/gui/render_panel.o src/gui/settings.o src/gui/snap_panel.o src/gui/symmetry_panel.o src/gui/tools_panel.o src/gui/topbar.o src/gui/view_panel.o src/i18n.o src/image.o src/imgui.o src/layer.o src/main.o src/marchingcube.o src/material.o src/meshoptimizer.o src/model3d.o src/palette.o src/pathtracer.o src/quantization.o src/quickjs.o src/render.o src/script.o src/shader_cache.o src/shape.o src/system.o src/tests.o src/theme.o src/tools.o src/tools/brush.o src/tools/color_picker.o src/tools/extrude.o src/tools/fuzzy_select.o src/tools/laser.o src/tools/line.o src/tools/move.o src/tools/plane.o src/tools/rect_select.o src/tools/selection.o src/tools/shape.o src/utils.o src/utils/b64.o src/utils/box.o src/utils/cache.o src/utils/color.o src/utils/geometry.o src/utils/gl.o src/utils/img.o src/utils/ini.o src/utils/json.o src/utils/mo_reader.o src/utils/mustache.o src/utils/path.o src/utils/sound.o src/utils/texture.o src/utils/vec.o src/volume.o src/volume_to_vertices.o src/volume_utils.o src/xxhash.o src/yocto.o -lglfw3 -lopengl32 -lglew32 -lz -ltre -lgdi32 -lComdlg32 -lole32 -luuid -lshell32
Building compilation database compile_commands.json
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/goxel.o:goxel.c:(.text+0xbf6): undefined reference to `__imp___glewBindFramebuffer'
 
 ....


 .. ../x86_64-w64-mingw32/bin/ld.exe: src/gui.o:gui.cpp:(.text+0x2b05): undefined reference to `__imp___glewBufferData'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text+0x205): undefined reference to `NFD_Init'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text+0x2b5): undefined reference to `NFD_SaveDialogU8_With_Impl'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text+0x2bc): undefined reference to `NFD_Quit'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text+0x333): undefined reference to `NFD_OpenDialogU8_With_Impl'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text+0x33a): undefined reference to `NFD_Quit'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/main.o:main.c:(.text.startup+0x4cb): undefined reference to `__imp_glewInit'
 
 ....

 .. ../x86_64-w64-mingw32/bin/ld.exe: src/render.o:render.c:(.text+0x113a): undefined reference to `__imp___glewEnableVertexAttribArray'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/render.o:render.c:(.text+0x114f): undefined reference to `__imp___glewBindBuffer'
 
 ....

 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/gl.o:gl.c:(.text+0x23): undefined reference to `__imp___glewShaderSource'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/gl.o:gl.c:(.text+0x5f): undefined reference to `__imp___glewCompileShader'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/gl.o:gl.c:(.text+0x6a): undefined reference to `__imp___glewGetShaderiv'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/gl.o:gl.c:(.text+0xde): undefined reference to `__imp___glewGetShaderInfoLog'

 ....

  .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/gl.o:gl.c:(.text+0x948): undefined reference to `__imp___glewUniform2fv'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x19): undefined reference to `__imp___glewActiveTexture'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x26f): undefined reference to `__imp___glewGenerateMipmap'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x603): undefined reference to `__imp___glewBindFramebuffer'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x618): undefined reference to `__imp___glewDeleteRenderbuffers'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x631): undefined reference to `__imp___glewDeleteRenderbuffers'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x643): undefined reference to `__imp___glewDeleteFramebuffers'
 .. ../x86_64-w64-mingw32/bin/ld.exe: src/utils/texture.o:texture.c:(.text+0x6e9): undefined reference to `__imp___glewBindFramebuffer'
collect2.exe: error: ld returned 1 exit status

Understandably its probably my noob user error, but it would nice if the readme was more comprehensive/foolproof from a fresh install in anycase.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions