Author Topic: HOWTO: Use Cygwin 1.7 with Code::Blocks  (Read 15465 times)

Offline telluriuminc

  • Single posting newcomer
  • *
  • Posts: 2
HOWTO: Use Cygwin 1.7 with Code::Blocks
« on: January 20, 2010, 12:45:38 am »
Cygwin 1.7 changed the way symlinks were created and handled when invoked from a command prompt. I couldn't find a way to force CB to use a unix-link shell, but was able to find a work around when perusing the Cygwin mailing lists.

The symptom would show up with a message similar to the one below:

Execution of 'g++.exe -Wall -fexceptions  -g     -c c:/dev/code/cb1/main.cpp -o obj/Debug/main.o' in 'c:\dev\code\cb1' failed.

Executing the same command from the CMD.EXE prompt yields an "Access is denied" message. This was how I was able to track down why the issue occurred. For more info, see this cygwin mailing list thread: http://www.mail-archive.com/cygwin@cygwin.com/msg104088.html

Solution

The solution is to point your compiler and linker directly to the version of gcc and g++ that you want to use.

In my case, I wanted to use gcc-4.exe and g++-4.exe and so, I went into Settings->Compiler and Debugger->Toolchain executables. There I changed the "C Complier", "C++ Compiler" and "Linker for dynamic libs" to point to gcc-4.exe, g++-4.exe and g++-4.exe.

After this, compilation and linking worked fine.

It would also be a good idea to add an environment variable CYGWIN with a value of nodosfilewarning in Settings->Environment->Environment Variables. This eliminates the following (harmless) warning message:

 MS-DOS style path detected: c:/
  Preferred POSIX equivalent is: /c
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames


Hope this helps folks looking to get Cygwin 1.7 working w/ Code::Blocks.

Cheers.

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: HOWTO: Use Cygwin 1.7 with Code::Blocks
« Reply #1 on: January 20, 2010, 06:43:10 am »
Thanks for the hints! If you want to, you can add an article to the WiKi.
For example, this is a good place:
http://wiki.codeblocks.org/index.php?title=Installing_a_supported_compiler
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline telluriuminc

  • Single posting newcomer
  • *
  • Posts: 2
Re: HOWTO: Use Cygwin 1.7 with Code::Blocks
« Reply #2 on: January 25, 2010, 03:49:22 am »
Done. The information has been added to the wiki page as suggested.