Author Topic: Compiling with Code::Blocks on Windows  (Read 2867 times)

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Compiling with Code::Blocks on Windows
« on: 5 November 2008, 00:35:15 »
The VS solution file is imported easily into Code::Blocks. I downloaded zlib and put that into deps. I go to compile libglest but it comes up with incomplete type error. I tried with 0.2.x and 0.2.8a. I needed to remove "_inline" from glprocs.h

Code: [Select]
typedef struct _DirIterator {
struct __finddata64_t fi;
intptr_t handle;
} DirIterator;

Build Messages:
include\platform\win32\platform_util.h|134|error: field `fi' has incomplete type|
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: Compiling with Code::Blocks on Windows
« Reply #1 on: 5 November 2008, 02:45:59 »
Hmm, very interesting. Thanks for posting this, although I don't quite understand the real problem and what you did to fix it.  Did you remove all occurrences of "_inline" from glproc.h?  If you did that, it would seem that the linker would run into multiple symbol definitions for every .c or .cpp file that #included glprocs.h, unless you moved them to the .c file and turned their inline implementations into prototypes.  That wouldn't really cause any optimization issues if the compiler supported cross-object file optimizations (like the m$ compiler does) and you allow the compiler to inline where it pleased.  If the compiler doesn't support cross-object file optimizations (m$ calls them "whole program optimizations") then it could effect performance.

Anyway, can you please post more details on this?

Also, I didn't realize that the win32-deps.zip was out of date, but I did indeed add zlib later, I should add it and post a new deps download, thanks.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Compiling with Code::Blocks on Windows
« Reply #2 on: 5 November 2008, 09:50:00 »
All I did was comment out '_inline' because of a different error. Sorry, now that I look at it it does read like I fixed it by doing that.
Code: [Select]
..\..\..\deps\include\glprocs.h|2176|error: `_inline' does not name a type|
Code::Blocks is using make.

__finddata64_t is a standard Microsoft Run-time Type.

I found this from http://bytes.com/forum/thread484812.html :
Quote
Unless you define one of the two symbols that are in the
implementations reserved name space, you won't have a declaration of
the struct list_head, and hence you will have an incomplete type.

Scope problem?
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: Compiling with Code::Blocks on Windows
« Reply #3 on: 5 November 2008, 12:12:06 »
Quote from: "hailstone"
All I did was comment out '_inline' because of a different error. Sorry, now that I look at it it does read like I fixed it by doing that.
Code: [Select]
..\..\..\deps\include\glprocs.h|2176|error: `_inline' does not name a type|
LOL!  Try adding -D_inline=inline to your CPPFLAGS :) (and revert everything else back to the way it was)

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Compiling with Code::Blocks on Windows
« Reply #4 on: 6 November 2008, 12:44:12 »
Thanks. That is the first error solved.

For the second I don't think the preprocessor variables are being set.

In io.h
Code: [Select]
#if __MSVCRT_VERSION__ >= 0x0601
struct __finddata64_t {
        unsigned    attrib;
        __time64_t  time_create;
        __time64_t  time_access;
        __time64_t  time_write;
/* 8 bytes are returned so it can't be _fsize_t */
        __int64    size;
         char       name[FILENAME_MAX];
};
#endif
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: Compiling with Code::Blocks on Windows
« Reply #5 on: 6 November 2008, 13:09:06 »
Ok, maybe I should just download Code::Blocks and give it a try.  While compiler does Code::Blocks actually use?  It sounds like it's failing to import pre-processor definitions or something.  Which version of Code::Blocks are you using?  If it' using a version of the MS Visual C Runtime less than 6.0.1, I think it's probably just not going to work at all (because it sounds like that's what glprocs.h requires, but they forgot to put a check in their header, but maybe __MSVCRT_VERSION__ just isn't going to work at all.  Also, this is a library that I think Martiño is even looking at changing in favor of glew.

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Compiling with Code::Blocks on Windows
« Reply #6 on: 6 November 2008, 13:27:17 »
I'm using Code::Blocks version 8.02 with mingw32-g++ and make. There is a setup that includes mingw.

Quote
# Multiple compiler support:

    * GCC (MingW / GNU GCC)
    * MSVC++
    * Digital Mars
    * Borland C++ 5.5
    * Open Watcom
    * ...and more

Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

daniel.santos

  • Guest
Re: Compiling with Code::Blocks on Windows
« Reply #7 on: 6 November 2008, 13:37:48 »
Quote from: "hailstone"
I'm using Code::Blocks version 8.02 with mingw32-g++ and make. There is a setup that includes mingw.

Quote
# Multiple compiler support:

    * GCC (MingW / GNU GCC)
    * MSVC++
    * Digital Mars
    * Borland C++ 5.5
    * Open Watcom
    * ...and more

oooh, nice :)  You'll get better mileage out of their compiler.  I'm trying to figure out if I can legally use it on my Linux box and automate win32 compilations from Linux, I might have to buy the full product, I'm not certain yet.