SDL & Linux

Started by
2 comments, last by klems 14 years, 10 months ago
Hello, Today I loaded my visual studio project to check Linux compatibility. I fixed some small things but now I am stuck on this: error: conflicting declaration ‘typedef long unsigned int size_t’ error: ‘size_t’ has a previous declaration as ‘typedef unsigned int size_t’ I know very well what this means but I do not know how to solve it. My windows xp pc is 32 bit, and my Ubuntu pc is 64 bit. I tried -m32 but it gave me the same error but then on a different typedef. The conflict is between SDL_config_minimal.h and in the -m32 case: stdint.h, and in the x64 case: stddef.h How can I solve this? (Without actually modifing the header files that is). Thanks a lot!
Advertisement
The SDL header files should never try to redefine size_t on Linux, so if you've just copied the Windows headers to your Linux machine instead of properly installing the SDL development package (libsdl1.2-dev) through apt-get/synaptic, that's most likely what causes trouble.
Thanks for the reply.

Yes I did just copy, but since I am building from source I thought that should have been taken care of?
Quote:Original post by Dolf
Thanks for the reply.

Yes I did just copy, but since I am building from source I thought that should have been taken care of?
SDL presents the same interface to the outside world, but its internals are by necessity quite different depending on which platform it's run/compiled on. The problem you're running into, for example, is that SDL has to define size_t for MSVC since MSVC apparently doesn't do that itself. With GCC, on the other hand, size_t is always defined in the standard headers, so SDL obviously has no business redefining it if used with GCC.

This situation could have been solved by #define hackery, but many others would not. For example, the low level interface to sound devices (or any devices, for that matter) is very different on most of SDL's supported platforms, and the format for the link-time libraries as well. The SDL dev packages only support the specific platform they're intended for, so you'll have to install the proper one, either for cross compiling or, as in your case, on a build machine running the target platform.

This topic is closed to new replies.

Advertisement