Author Topic: [solved] Compiling a SDL project under Cygwin/MinGW  (Read 4986 times)

Offline palirath

  • Single posting newcomer
  • *
  • Posts: 2
    • Egoboo Community Forum
[solved] Compiling a SDL project under Cygwin/MinGW
« on: September 08, 2011, 03:24:55 am »
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 ;) )

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9661
Re: [solved] Compiling a SDL project under Cygwin/MinGW
« Reply #1 on: September 08, 2011, 06:22:26 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: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline palirath

  • Single posting newcomer
  • *
  • Posts: 2
    • Egoboo Community Forum
Re: [solved] Compiling a SDL project under Cygwin/MinGW
« Reply #2 on: September 09, 2011, 12:00:35 am »
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.