Code::Blocks Forums

User forums => General (but related to Code::Blocks) => Topic started by: cola on August 18, 2020, 12:39:38 am

Title: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola 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?
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: BlueHazzard on August 18, 2020, 09:10:53 am
Download glut, build it and use the project wizard in codeblocks
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola on August 18, 2020, 11:11:36 am
Are you telling to download glut source code?
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: BlueHazzard 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...
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: BlueHazzard on August 18, 2020, 01:20:13 pm
Here is probably an instruction https://www.transmissionzero.co.uk/computing/using-glut-with-mingw/
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: Miguel Gimenez 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.
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola on August 19, 2020, 05:41:52 am
I have installed codeblocks-20.03mingw-setup.exe. How will I compile freeglut-3.2.1?
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: BlueHazzard 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...
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola 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?
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: stahta01 on August 20, 2020, 11:02:54 am
Link to readme from OP last link.https://www.transmissionzero.co.uk/files/software/development/GLUT/Readme.txt (https://www.transmissionzero.co.uk/files/software/development/GLUT/Readme.txt)

Tim S.
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola on August 20, 2020, 12:55:11 pm
https://www.transmissionzero.co.uk/files/software/development/GLUT/freeglut-MinGW.zip , downloading this worked with mingw 32 bit.
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: cola 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
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?
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: Miguel Gimenez 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.
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: stahta01 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
--- 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.
Title: Re: How can I install glut in clodeblocks 64 bit with mingw?
Post by: gd_on 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.