NO

Author Topic: Compiling freeglut to work with Pelles C  (Read 5320 times)

prog

  • Guest
Compiling freeglut to work with Pelles C
« on: October 10, 2012, 07:49:37 PM »
I would like to use the freeglut library - http://freeglut.sourceforge.net/.

The project has links to some binaries that are available for windows, but the MSVC binaries do not work with Pelles C.

I was hoping to properly compile for Windows 32 and 64 bit from the source of the latest release 2.8.0, but I have never worked something like this out. What steps should I take to get this going?

prog

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #1 on: October 10, 2012, 08:07:32 PM »
So far, I imported the freeglut packages msvc project into Pelles C and I get the following error

Code: [Select]
Building freeglut_main.obj.
C:\Users\user\Documents\Pelles C Projects\freeglut\freeglut_main.c(529): error #1019: Syntax error in #if/#elif expression.
C:\Users\user\Documents\Pelles C Projects\freeglut\freeglut_main.c(2443): error #1019: Syntax error in #if/#elif expression.
C:\Users\user\Documents\freeglut-2.8.0\include\GL\freeglut_std.h(616): warning #2135: Static 'glutCreateMenu_ATEXIT_HACK' is not referenced.
C:\Users\user\Documents\freeglut-2.8.0\include\GL\freeglut_std.h(614): warning #2135: Static 'glutCreateWindow_ATEXIT_HACK' is not referenced.
C:\Users\user\Documents\freeglut-2.8.0\include\GL\freeglut_std.h(612): warning #2135: Static 'glutInit_ATEXIT_HACK' is not referenced.
*** Error code: 1 ***
Done.

Since freeglut is a proven package and it should compile with msvc, I don't want to touch any of the preprocessor directives or even the warnings until I get a second opinion on this. If someone has the time, could you please download the sources from the link in the first post and try this?

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Compiling freeglut to work with Pelles C
« Reply #2 on: October 10, 2012, 08:11:47 PM »
Quote
The project has links to some binaries that are available for windows, but the MSVC binaries do not work with Pelles C.
This example use those binaries. Drop it into freeglut directory.
May the source be with you

prog

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #3 on: October 10, 2012, 08:17:47 PM »
I have been doing more work on this to make sure I understand.

Instead of trying to fix the code, I compiled without defining _DEBUG. It compiled without error, just warnings - which is expected.

I would really appreciate however, that if you can, please help me compile it with _DEBUG defined. I want to make sure I understand how I can follow a debug version.

So far, when the project is imported, Full debug is set in the properties, however, _DEBUG is also defined.error.

What exactly is happening here and how can I correctly put all of this together? In other words - "I have no idea" what is going on, or how debug information is being put together.

prog

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #4 on: October 10, 2012, 08:20:39 PM »
Hello, timovjl - I posted before I saw your post.

Now that I got an error free compile, I am hoping to get a better understanding of compiling imported projects. This might not be an import problem, but if you can take a look at it I would appreciate it.

prog

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #5 on: October 10, 2012, 08:37:00 PM »
I would like to contribute to what ended up being a stupid mistake. I can't say anyone else will make this mistake, but I hope it helps if you do.

The entire problem started when I could not use the binaries off of the freeglut website links to compile a GLUT application.

It turns out, I did not realize that GLUT applications need to be compiled as console apps, so I was getting WinMain errors. I will test those binaries again in a few moments. So to make a long story short, all this might not have been necessary.

The good result is, that I got an idea on importing msvc projects. So I'm still hoping someone interested might solve the _DEBUG issue, or at least help me resolve it. After all this, it would be nicer if I can make good binaries myself.

prog

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #6 on: October 10, 2012, 08:42:08 PM »
Just as I thought, Martin Payne's Windows binaries (MSVC) works out of the box. It was just a stupid mistake on my end.

CommonTater

  • Guest
Re: Compiling freeglut to work with Pelles C
« Reply #7 on: October 10, 2012, 08:55:19 PM »
For your issue with _DEBUG ... Pelles compiler (POCC) doesn't recognize the symbol the way MSVC does.  Instead you have to set debugging options in the Project -> Project options -> Compiler and Linker tabs.  It compiles to the same object unlike MSVS projects which produce separate folders for Release and Debug.

 

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2091
Re: Compiling freeglut to work with Pelles C
« Reply #8 on: October 10, 2012, 09:19:14 PM »
So I'm still hoping someone interested might solve the _DEBUG issue, or at least help me resolve it. After all this, it would be nicer if I can make good binaries myself.
use _DEBUG=1
May the source be with you