Author Topic: How can I install glut in clodeblocks 64 bit with mingw?  (Read 932 times)

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
How can I install glut in clodeblocks 64 bit with mingw?
« on: August 18, 2020, 12:39:38 am »
I have installed codeblocks 64 bit with mingw. How can I install glut in codeblocks 64 bit with mingw?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2842
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #1 on: August 18, 2020, 09:10:53 am »
Download glut, build it and use the project wizard in codeblocks

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #2 on: August 18, 2020, 11:11:36 am »
Are you telling to download glut source code?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2842
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #3 on: August 18, 2020, 01:17:49 pm »
Yes, download the source code, build it according the instruction of the glut site, and then you can use the codeblocks wizard. Point it where it asks and it should work...

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2842

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 552
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #5 on: August 18, 2020, 02:15:49 pm »
I have just tested FreeGlut and it is easy to compile and use; Just use CMake-GUI to generate MinGW makefiles in a new folder (p.e freeglut-3.2.1\Build), open a console in that folder and run mingw32-make. You can then copy the lib folder inside Build to freeglut-3.2.1 and create a global variable in C::B called glut containing the path to the library (p.e. C:\Libraries\freeglut-3.2.1) in the base field and nothing in the other fields.

Then use the wizard to create the project. The only problem I have found with the wizard is the Execution Working Dir being set to $(#glut)/bin when it should be just bin/ . You will need to copy the Build\bin\libfreeglut.dll near the executable.

Other problem with the wizard is with the use of global variables, I specified $(#freeglut) in the wizard but the generated project used a mix of glut and freeglut. In a second try I had to use glut to work around the mix.

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #6 on: August 19, 2020, 05:41:52 am »
I have installed codeblocks-20.03mingw-setup.exe. How will I compile freeglut-3.2.1?

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2842
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #7 on: August 19, 2020, 09:10:53 am »
Make sure your compiler path is in the path variable:
search for gcc.exe in the codeblocks folder.
Check if the path to gcc.exe is in the PATH variable of windows. To check this, open the start menu and type "system environment variables" in the opening dialog -> "Environment variables" -> Uservariables for XXXXXX -> double click on the PATH. Check if the path to gcc is there. If not add it by pressing the "Browse" button

Now install CMake
Open CMake gui and follow a build instruction for freeglut in the internet....


Then you can follow the direction of miguel gimenez...

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #8 on: August 20, 2020, 12:11:07 am »
I have downloaded freeglut from https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MinGW.zip
Will it work with codeblocks-20.03mingw-setup.exe?
« Last Edit: August 20, 2020, 01:20:25 am by cola »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6996
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #10 on: August 20, 2020, 12:55:11 pm »

Offline cola

  • Single posting newcomer
  • *
  • Posts: 6
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #11 on: August 20, 2020, 01:06:40 pm »
I have tried to install from source code of freeglut-3.2.1. I have run CMake (cmake-gui).  I have selected mingw-makefile from cmake-gui. Clicked configure twice, configure is done, then clicked generate, generate is done. From a CMD command line window, from the directory where cmake made makefile and it is freeglut-3.2.1\build, I ran mingw32-make. Then I got some errors.
Code: [Select]
error: subscripted value is neither array nor pointer nor vector
  155 |             if (pRawInput->data.hid.bRawData[0] ==
CMakeFiles\freeglut.dir\build.make:543: recipe for target 'CMakeFiles/freeglut.dir/src/mswin/fg_spaceball_mswin.c.obj' failed
mingw32-make[2]: *** [CMakeFiles/freeglut.dir/src/mswin/fg_spaceball_mswin.c.obj] Error 1
CMakeFiles\Makefile2:170: recipe for target 'CMakeFiles/freeglut.dir/all' failed
mingw32-make[1]: *** [CMakeFiles/freeglut.dir/all] Error 2
Makefile:147: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
What will I do?

Offline Miguel Gimenez

  • Lives here!
  • ****
  • Posts: 552
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #12 on: August 20, 2020, 07:33:54 pm »
The compilation of the library is out of the scope of this forum. Can you check if the libraries have been already created?. The error may be in the compilation of a sample. You should see two .a files in the lib folder and a file called freeglut.dll in the bin folder.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 6996
    • My Best Post
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #13 on: August 20, 2020, 10:28:20 pm »
Does anyone have reason to believe freeglut can be compiled with an 64 bit version of MinGW GCC?
If yes, please state why you believe this.


Edit: I found that the MSys2 MINGW 64 bit version exists.
But, it uses this patch.
Code: [Select]
--- a/CMakeLists.txt 2019-09-25 23:43:34.000000000 +0300
+++ b/CMakeLists.txt 2019-09-30 21:10:08.047600000 +0300
@@ -67,16 +67,12 @@
 
 
 SET(FREEGLUT_HEADERS
+    include/GL/glut.h
     include/GL/freeglut.h
     include/GL/freeglut_ucall.h
     include/GL/freeglut_ext.h
     include/GL/freeglut_std.h
 )
-IF(FREEGLUT_REPLACE_GLUT)
-    LIST(APPEND FREEGLUT_HEADERS
-        include/GL/glut.h
-    )
-ENDIF()
 SET(FREEGLUT_SRCS
     ${FREEGLUT_HEADERS}
     src/fg_callbacks.c

It may or may not be related to the OP build problem.

Tim S.
« Last Edit: August 20, 2020, 10:33:25 pm by stahta01 »
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 32 bit.
On Debian Stretch, compiling CB Trunk against wxWidgets 3.0.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline gd_on

  • Lives here!
  • ****
  • Posts: 578
Re: How can I install glut in clodeblocks 64 bit with mingw?
« Reply #14 on: August 21, 2020, 04:18:28 pm »
I commonly use freeglut 3.2.1 compiled in 64 bits. I have made no patches. I have followed some instructions in https://www.transmissionzero.co.uk/computing/using-glut-with-mingw/ where you can find freeglut dlls for 32 and 64 bits. But I also built a cbp file attached here and placed directly in my freeglut-3.2.1 folder (with src, include, ... subfolders), of course adapted to my installation, but should work without many modifications.
If that can help.
« Last Edit: August 21, 2020, 04:21:26 pm by gd_on »
Windows 10 64 bits (20.04), svn C::B (last version or almost!), wxWidgets 3.1.4, Msys2 Compilers 10.2.0, 64 bits (seh, posix : gcc, g++ and gfortran in C:\msys64\mingw64) or 32 bits (sjlj, posix in C:\msys64\mingw32).