NO

Author Topic: How to build FreeGLUT with Pelles C?  (Read 4369 times)

YellowBeast

  • Guest
How to build FreeGLUT with Pelles C?
« on: April 29, 2014, 12:17:20 PM »
Hello people!
I would appreciate it a lot if someone could give me a step-by-step tutorial for how to build the FreeGLUT libraries with Pelles C 7.

So far, I can build the LIB and the DLL (by simply compiling all the C files in src), but I get a lot of "not referenced" warnings, and the program using FreeGLUT crashes when started.

Something I am not doing right so I'd like to know how others do it instead.
Thank you.

Here FreeGLUT 2.8.1 can be downloaded:
http://freeglut.sourceforge.net/

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to build FreeGLUT with Pelles C?
« Reply #1 on: April 29, 2014, 02:09:12 PM »
With static library use define FREEGLUT_STATIC FREEGLUT_BUILDING_LIB
Check this example.
« Last Edit: May 01, 2014, 09:16:56 AM by TimoVJL »
May the source be with you

YellowBeast

  • Guest
Re: How to build FreeGLUT with Pelles C?
« Reply #2 on: April 29, 2014, 03:04:07 PM »
TimoVJL, thank you very much for your project sample.
After configuring it to use the FreeGLUT include folder on my computer, both the LIB and EXE compile fine and work.

I have some questions:

1. The "XYZ is not referenced" warnings still appear when compiling the library.
Why? And how can they be fixed?

2. For the LIB, the compiler uses __cdecl calling convention but assembler uses stdcall.
I don't understand how different conventions work together.

3. For the LIB, why was the file freeglut_ext.c excluded?

Thanks again.

YellowBeast

  • Guest
Re: How to build FreeGLUT with Pelles C?
« Reply #3 on: May 01, 2014, 08:10:37 AM »
Bumping for interest.
Could someone try to answer my questions above, please? Thank you.

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to build FreeGLUT with Pelles C?
« Reply #4 on: May 01, 2014, 09:24:05 AM »
1. The "XYZ is not referenced" warnings still appear when compiling the library.
Why? And how can they be fixed?
Turn off warnings. ;)

2. For the LIB, the compiler uses __cdecl calling convention but assembler uses stdcall.
I don't understand how different conventions work together.
__cdecl was chosen because new users try to make console application anyway. ;)

3. For the LIB, why was the file freeglut_ext.c excluded?
Mistake? That's for DLL ?   :-\
May the source be with you

Offline jj2007

  • Member
  • *
  • Posts: 536
Re: How to build FreeGLUT with Pelles C?
« Reply #5 on: May 01, 2014, 09:27:34 AM »
2. For the LIB, the compiler uses __cdecl calling convention but assembler uses stdcall.
I don't understand how different conventions work together.

The caller overrides its default convention:
int __stdcall some_C_function(void);

YellowBeast

  • Guest
Re: How to build FreeGLUT with Pelles C?
« Reply #6 on: May 01, 2014, 12:07:41 PM »
1. The "XYZ is not referenced" warnings still appear when compiling the library.
Why? And how can they be fixed?
Turn off warnings. ;)
Heh. ::)
Seriously though, what do the warnings mean exactly?

2. For the LIB, the compiler uses __cdecl calling convention but assembler uses stdcall.
I don't understand how different conventions work together.
__cdecl was chosen because new users try to make console application anyway. ;)
Well in the case this will help others, my current settings are:

(both library and test program)
Compiler -> Calling conv: __cdecl
Assembler -> Calling conv: cdecl

(test program)
Linker -> Subsystem -> Type: Windows
Linker -> Entry point: mainCRTStartup

2. For the LIB, the compiler uses __cdecl calling convention but assembler uses stdcall.
I don't understand how different conventions work together.

The caller overrides its default convention:
int __stdcall some_C_function(void);
By checking the source code of FreeGLUT, I didn't find any such overrides. Thanks for the idea though.

Offline Stefan Pendl

  • Global Moderator
  • Member
  • *****
  • Posts: 582
    • Homepage
Re: How to build FreeGLUT with Pelles C?
« Reply #7 on: May 01, 2014, 04:19:03 PM »
1. The "XYZ is not referenced" warnings still appear when compiling the library.
Why? And how can they be fixed?

The variables or other objects are declared, but never used.

To fix these, you need to use them, but if this is third party source code, it might just have been included for future use.
---
Stefan

Proud member of the UltraDefrag Development Team