News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

[solved] Compiling a SDL project under Cygwin/MinGW

Started by palirath, September 08, 2011, 03:24:55 AM

Previous topic - Next topic

palirath

I am responsible for the development of a multi-platform game that runs under SDL and OpenGL, and the C::B is the only decent IDE I can find that runs on all 3 platforms we are supposed to support. Because I am LAZY, I want to be able to test the program using the gcc compiler in a windows environment (cygwin/mingw), but C::B does not want to cooperate. I've looked around these forums and found several topics about this, but no solutions. So, I figured I would dump my wisdom in this thread.

The problem is that C::B completely ignores the following settings
  • "Compiler settings"->"Other options"->`sdl-config --cflags`
  • "Linker settings"->"Other linker options"->`sdl-config --libs`
and generates no error to tell you that the backquote substitution failed.

The root cause is that sdl-config is actually a script, and requires invoking a shell to interpret it. You can get the proper response by using:
  • "Compiler settings"->"Other options"->`sh /usr/local/bin/sdl-config --cflags`
  • "Linker settings"->"Other linker options"->`sh /usr/local/bin/sdl-config --libs`

I hope this helps.




PS I am using C::B 10.02 and a recent version of Cygwin ( as of 2011-09-07, Japanese convention ;) )

MortenMacFly

Quote from: palirath on September 08, 2011, 03:24:55 AM
  • "Compiler settings"->"Other options"->`sh /usr/local/bin/sdl-config --cflags`
  • "Linker settings"->"Other linker options"->`sh /usr/local/bin/sdl-config --libs`
That is correct but requires to have a unix shell emulation. As Windows does not provide one, you'll need to install one e.g. of the MSYS project or alike. You cannot expect that unix shell scripts run out-of-the-box on Windows (Why should you? :shock:), as Windows is in no way compatible to the unix OS in that point. So this requires either a simulation layer or adding the appropriate compiler/linker options directly.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

palirath

There is a default C::B project configuration for "Cygwin GCC" which is partially Cygwin aware, in that you can execute Cygwin's commandline functions. C::B could send all of its compiler commands to a Cygwin command interpreter like sh or bash... ( I guess we can hope for the day. :cry: )

As I said, I merely put this in here because I could find no definitive answer to this problem anywhere on this site or the web, but a lot of discussion and half-baked suggestions.