Thread: Cannot find where to define HAVE_STDIO_H in SDL

  1. #1
    Registered User
    Join Date
    Feb 2010
    Posts
    17

    Cannot find where to define HAVE_STDIO_H in SDL

    I just started using SDL so that I can load images as textures in opengl.
    If i include <SDL.h> then I printf's are not displayed but if I just include <SDL_Video.h>, then i do see my printf's. I have, ofcourse included <stdio.h> but i have found that one of the headers that <SDL.h> includes is SDL_stdinc.h in which the following code appears:
    Code:
    #ifdef HAVE_STDIO_H
    #include <stdio.h>
    #endif
    This seems to highjack the <stdio.h> include in my .c file and waits for HAVE_STDIO_H to be defined. I have tried defining it in my makefile, my .c file and a seperate header file but nothing seems to work. I have seen #ifdef statements in other codes that are more complex than mine so I know it is a common thing to use in header files but I can't figure out where to define it.

    Can anyone help? I'm using MinGW with make on windows 7.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    HAVE_* macros are generally defined at configure-time to find what headers your system does/doesn't have. For SDL, they should be defined in SDL_config.h - e.g. you could run this program to determine the value of HAVE_STDIO_H:

    Code:
    #include <stdio.h>
    #include <SDL/SDL_config.h>
    
    int main(void)
    {
    #ifdef HAVE_STDIO_H
        printf("%d\n", HAVE_STDIO_H);
    #else
        printf("Not defined\n");
    #endif
        return 0;
    }
    If it's not defined, you could try changing its value in SDL_config.h, but it might be better to find out why the configure process thought that your system doesn't have a standard header file. Have a look through config.log in your build directory and search for "HAVE_STDIO_H", or post it here.
    Last edited by JohnGraham; 11-21-2010 at 06:21 AM.

  3. #3
    Registered User
    Join Date
    Feb 2010
    Posts
    17
    I ran the code above and it returns 1, which means the system has stdio.
    I have also checked the config file and it has it set to 1 so that is also as it should be.
    I can't find the config.log file (don't know where to look either) but i've tried using math.h and everything from that is blocked too. If I just include SDL_Video.h, the math.h stuff does work.

    I've tried disabling the check for HAVE_STDIO_H in SDL_stdinc.h by commenting it but that makes no difference.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. RS232 connection set up
    By cs342 in forum C Programming
    Replies: 25
    Last Post: 05-26-2010, 03:57 AM
  2. Winsock problem
    By Wolf` in forum Windows Programming
    Replies: 1
    Last Post: 05-01-2010, 04:55 PM
  3. Compiling error: Too many arguments.
    By Tuah in forum C++ Programming
    Replies: 16
    Last Post: 06-10-2008, 04:28 PM
  4. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 07:35 AM