# CGX build for Windows

**URL:** <https://calculix.discourse.group/t/cgx-build-for-windows/98>\
**Category:** CalculiX GraphiX\
**Created:** [August 8, 2020, 8:35pm UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98 "2020-08-08T20:35:16Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![imirzov](https://yyz2.discourse-cdn.com/free1/user_avatar/calculix.discourse.group/imirzov/32/1304_2.png) [@imirzov](https://calculix.discourse.group/u/imirzov)\
**Post date:** [August 8, 2020, 8:35pm UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/1 "2020-08-08T20:35:16Z")

</div>

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:

> [@CGX with new colormaps](https://calculix.discourse.group/t/cgx-with-new-colormaps/51):
>
> Dear CalculiX users, CalculiX GraphiX with a few new colormaps and ‘cmap’ command is available. Please, follow link for details and downloads:

Thank you in advance.

Ihor

---

<div class="post-metadata">

**Author:** ![rafal.brzegowy](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rafal.brzegowy](https://calculix.discourse.group/u/rafal.brzegowy)\
**Post date:** [August 10, 2020, 6:28am UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/2 "2020-08-10T06:28:23Z")

</div>

Hi,

In calculix\_2.17\_4win.zip (from: [http://www.dhondt.de/calculix\_2.17\_4win.zip](http://www.dhondt.de/calculix_2.17_4win.zip)) you can find my patch file: cgx\_2.17\_mingw.patch

For mingw64:  
1.  
in folder /usr/local/CalculiX/cgx\_2.17 please use: patch -p2 \< …/…/cgx\_2.17\_mingw.patch  
2.  
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

[https://github.com/GeneralElectric/CalculiX/blob/master/src/downloads/glut-3.7.6-bin-32and64.zip](https://github.com/GeneralElectric/CalculiX/blob/master/src/downloads/glut-3.7.6-bin-32and64.zip)

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:

Regards  
Rafal

---

<div class="post-metadata">

**Author:** ![rafal.brzegowy](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rafal.brzegowy](https://calculix.discourse.group/u/rafal.brzegowy)\
**Post date:** [August 17, 2020, 7:57am UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/3 "2020-08-17T07:57:58Z")

</div>

Update:  
patch -p2 \< …/…/cgx\_2.17\_mingw.patch

---

<div class="post-metadata">

**Author:** ![ceanwang](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@ceanwang](https://calculix.discourse.group/u/ceanwang)\
**Post date:** [March 26, 2021, 12:09pm UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/4 "2021-03-26T12:09:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rafal.brzegowy](https://avatars.discourse-cdn.com/v4/letter/r/a9adbd/32.png) [@rafal.brzegowy](https://calculix.discourse.group/u/rafal.brzegowy)\
**Post date:** [March 26, 2021, 12:26pm UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/5 "2021-03-26T12:26:04Z")

</div>

Try download:

 ![image](https://global.discourse-cdn.com/free1/uploads/calculix/original/1X/74b82e3be9e6b6a7882c89ca05f09f9ff303f508.png)

---

<div class="post-metadata">

**Author:** ![ceanwang](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@ceanwang](https://calculix.discourse.group/u/ceanwang)\
**Post date:** [March 26, 2021, 12:27pm UTC](https://calculix.discourse.group/t/cgx-build-for-windows/98/6 "2021-03-26T12:27:40Z")

</div>

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](https://stackoverflow.com/questions/341817/is-there-a-replacement-for-unistd-h-for-windows-visual-c)
