Git Product home page Git Product logo

Comments (1)

Flower35 avatar Flower35 commented on September 2, 2024

This depends on your Linux distribution and how the SDL2 development files were packaged.

For example, on my distro (Void Linux), and on the MSYS2/MINGW64 Windows version, there is this useful file: /usr/include/SDL2/SDL_config.h

/* Comment this if you want to build without any C library requirements */
#define HAVE_LIBC 1
#ifdef HAVE_LIBC

#define STDC_HEADERS 1
#define HAVE_CTYPE_H 1
#define HAVE_STDIO_H 1
#define HAVE_STRING_H 1

However, when I tried to cross compile a Windows 64-bit build on Linux, these were the contents of: /usr/local/x86_64-w64-mingw32/include/SDL2/SDL_config.h

/* This is disabled by default to avoid C runtime dependencies and manifest requirements */
#ifdef HAVE_LIBC

So it turns out the source code relied in some places to have the standard C headers automatically included when using the SDL2 library:

#include <SDL2/SDL.h>
// #include <ctype.h>
// #include <stdio.h>
// #include <string.h>

Since I had installed additional headers and libraries in /usr/local/ directory without using a package manager, and that SDL2 is included in all builds (either as a Window API or a Controller Backend), then my workaround was to change the /usr/local/x86_64-w64-mingw32/bin/sdl2-config file in the following way:

--cflags)
# echo -I${prefix}/include/SDL2 -Dmain=SDL_main
echo -I${prefix}/include -Dmain=SDL_main -DHAVE_STDIO_H -DHAVE_STRING_H -DHAVE_CTYPE_H

from sm64coopdx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.