CGX build for Windows

Dear CalculiX users,

I know that a few of the most advanced users succeeded to compile CGX in Windows. After one week I give up.

I’ve tried both cygwin and mingw. Tested GE scripts. Read many blog articles. But no success.

Please, if you have an exhaustive manual on how to build CGX in Windows, - share it. Without it I can’t provide Windows binary for updated CGX with new colormaps:

Thank you in advance.


1 Like


In (from: you can find my patch file: cgx_2.17_mingw.patch

For mingw64:
in folder /usr/local/CalculiX/cgx_2.17 please use: patch -p2 < …/…/cgx_2.17_mingw.patch
change folder to src and use: make Makefile_migw -j4

You can used: Makefile_mingw for glut base, Makefilke_mingw_static for static freeglut base or Makefile_mingw_fg for dynamic freeglut.

Of course you need a glut file or a freeglut library:
pacman -S mingw-w64-x86_64-freeglut

It works with standard cgx source code, but in yours I have this error:

setFunktions.c:15205:5: error: unknown type name ‘Bool’; did you mean ‘_Bool’?
15205 | Bool cmap_found = False;
| ^~~~
| _Bool
setFunktions.c:15205:23: error: ‘False’ undeclared (first use in this function)
15205 | Bool cmap_found = False;
| ^~~~~
setFunktions.c:15205:23: note: each undeclared identifier is reported only once for each function it appears in
setFunktions.c:15208:22: error: ‘True’ undeclared (first use in this function)
15208 | cmap_found = True;
| ^~~~
In file included from ./extUtil.h:30,
from spline.c:1:


patch -p2 < …/…/cgx_2.17_mingw.patch

How do I download the glut-3.7.6 zip file?

Clicking the link doesn’t start downing it. Then I choose Go to file, then search the file in the list.

When found, I tried right click on the name, then Save link as, but 7z can’t unzip it.

Try download:

Thanks. Haven’t seen that.

Tried to compile with ms-vs 2017 and got this error:

D:\00master\cgx_2.17.1\src\extUtil.h(10): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
Done building project "bjcgx.vcxproj" -- FAILED.

I run into this in another project, so think it is common when changing to MS-VS.
Need to figure it out from this:
c++ - Is there a replacement for unistd.h for Windows (Visual C)? - Stack Overflow