This is my second attempt at getting GLUT to work after being totally baffled the first time a while back, and not managing to solve the problem by inquiring on the Pelles C forum, which to compound the problem I can’t even access at the moment for some reason!
Upon compiling I get just the following two errors:
C:\Program Files\PellesC\Include\gl\glut.h(19): error #1050: Macro redefinition of ‘APIENTRY’.
C:\Program Files\PellesC\Include\gl\glut.h(20): error #1050: Macro redefinition of ‘CALLBACK’.
*** Error code: 1 ***
As far as I can see, I have put all the right files in the right places and ticked the right boxes in the project options (e.g. allow microsoft extensions), and after searching the web for F.A.Q.s I can’t find the above errors being addressed. I should stress that although being able to program some C I’m no expert at all this stuff so I could still be doing something stupid I guess.
Within Dev-C++, in menu Tools, Check for updates/packages, then community packs or something. I recommend the freeglut examples (modern opensource GLUT).
Then File, new project, multimedia tab, freeglut. F9. It works.
Ok then, next problem that I have no idea of the source of…
I downloaded CodeBlocks (or should I say Code::Blocks) (the version with MINGW compiler) and opened a new OpenGL application project. Then I pasted the code from this OpenGL tutorial (http://www.gmonline.demon.co.uk/cscene/CS5/CS5-03.html) which is the same code I was trying to get working in PellesC and built the project. However, it doesn’t build, it says:
Switching to target: default
mingw32-g++.exe: installation problem, cannot exec `cc1plus’: No such file or directory
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
which to me doesn’t look like a problem with the code. But what do I know. Maybe there was something else (containing cc1plus) that I should have downloaded?
Edit: re-read your post. Maybe try updating to the latest version, found in the forums? The one with mingw bundled is over two years old. Now that you have the compiler, it should be simple to upgrade. Alternatively, search http://mingw.org for the missing file.
True, downloading Dev-C++ might save you some hassle, but it’s buggy and it uses an old version of MingW. And in any case, it’s a good idea to learn how to setup the compiler toolchain - it’s depressing how many people call themselves programmers and don’t even know the difference between an IDE and a compiler (e.g. “I use the Visual Studio compiler”, ugh!)
Righty then, I’m back for more punishment. ZbuffeR, I downloaded Dev-C++, and updated with the freeglut file. However, it doesn’t compile and complains that:
15 C:\Dev-Cpp\main01.cpp GL/glut.h: No such file or directory.
So, obviously it can’t find GLUT. So, can I ask what exactly do I do to let it find it. I can see a few places in the compiler options which look like I could add some kind of path to but I don’t know EXACTLY what to do… help!
Hehehe…Reminds me of 3rd year at uni. We had people trying run their source code when the moved onto a Linux system from Windows.
As for AndyCav’s problem, sorry never used Dev-c++, but I wonder what the point is in trying to get this to work…If you can’t solve problems like this then what are you actually going to write? Not very helpful I know, but…
Edit: So at least there is some useful content. Another option is to install cygwin and compile all this from the command line using good old gcc/g++. Then you have total control (so -I <inc path> to tell it where to get header files etc.)
I then use Eclipse for my IDE (with the vi plugin 8-), svn for version control and autoconf for build/packaging.
Well, I just updated Dev-C++ with the package “glut” and that appears to have solved it for Dev-C++; I have spinning cones and spheres on the screen. Cheers for the help.
Stu, I know what you mean but then where do I start?! I mean I want to start learning OpenGL, but first I have to get something working so I can even just run the example code you find in tutorials and the like - and I couldn’t even get that running so I couldn’t even start learning. It’s a catch-22.
Was anyway. It’s all a bit complicated if you don’t already know exactly how this stuff works. For example - I just finally got the freeglut thing to work after being advised to dowload it, but I didn’t know (as silly as it may seem) that you also have to download another package just called “glut”. It wasn’t obvious to a beginner.
I’m quite amazed that there isn’t just some software you can download as one unit that’ll allow you to do this stuff without having to know how to add in extra packages, tell various things like linkers, compliers and other robots where to find their necessary files, update with the latest versions etc! I realise that these IDEs are designed to have maximum potential for modification and stuff so that inevitably they are like this, but it makes it rather prohibitive to beginners. Well, beginners who are trying to pick it up on their own anyway!