Difference between revisions of "Installing Cygwin Compiler"

From Code::Blocks
(First version)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Installation\Build Instructions]]
+
[[Category:User Documentation]]
 
== Attaching the compiler framework ==
 
== Attaching the compiler framework ==
 
Make sure that you have installed Cygwin at least with the GCC, G++ and GDB packages. This article describes the steps required to attach the GNU Cygwin Compiler suite.
 
Make sure that you have installed Cygwin at least with the GCC, G++ and GDB packages. This article describes the steps required to attach the GNU Cygwin Compiler suite.
Line 6: Line 6:
  
 
* Make a copy of the GNU GCC compiler as follows:
 
* Make a copy of the GNU GCC compiler as follows:
1.) Goto menu "Settings" -> "Compiler"
+
** Goto menu "Settings" -> "Compiler"
2.) Select the "GNU GCC Compiler", click the "Copy Button"
+
** Select the "GNU GCC Compiler", click the "Copy Button"
3.) Save the copy e.g. under "Cygwin GCC Compiler"
+
** Save the copy e.g. under "Cygwin GCC Compiler"
  
 
* Setup the compiler as follows:
 
* Setup the compiler as follows:
  
1.) Under the "Programs" tab point the path to your Cygwin installation folder
+
* Under the "Programs" tab:
2.) Change under the "Programs" tab: "C compiler" =  "g77.exe", "Linker for dynamic libs": "g77.exe"
+
** point the path to your Cygwin installation folder
  - under "Additional path" add [Cygwin]\usr\X11R6\bin (if required)
+
** under "Additional path" add [Cygwin]\usr\X11R6\bin (if required)
  - under "Program files" setup the following for the executables:
+
** under "Program files" setup the following for the executables:
    - C Compiler:              gcc.exe
+
** (Note, The "-3" may need to be changed to "-4" in the following exe)
    - C++ Compiler:            g++.exe
+
*** C Compiler:              gcc-3.exe
    - Linker for dynamic libs: g++.exe
+
*** C++ Compiler:            g++-3.exe
    - Linker for tatic libs:   ar.exe
+
*** Linker for dynamic libs: g++-3.exe
    - Debugger:                gdb.exe
+
*** Linker for static libs: ar.exe
    - Resource compiler:      windres.exe
+
*** Debugger:                gdb.exe
    - Make program:            make.exe
+
*** Resource compiler:      windres.exe
3.) Under the "Directories" tab make sure to adjust the include/lib path's:
+
*** Make program:            make.exe
  - tab "compiler" (notice the "\usr" in contrast to the linker):
+
 
    - add [Cygwin]\usr\include
+
* Under the "Directories" tab make sure to adjust the include/lib path's:
    - add [Cygwin]\usr\X11R6\include (if required)
+
** tab "compiler" (notice the "\usr" in contrast to the linker):
  - tab "compiler" (notice the missing "\usr" in contrast to the compiler):
+
*** add [Cygwin]\usr\include
    - add [Cygwin]\lib
+
*** add [Cygwin]\usr\X11R6\include (if required)
    - add [Cygwin]\usr\X11R6\lib (if required)
+
** tab "linker" (notice the missing "\usr" in contrast to the compiler):
  - tab "Resource compiler"
+
*** add [Cygwin]\lib
    - add [Cygwin]\usr\include
+
*** add [Cygwin]\usr\X11R6\lib (if required)
    - add [Cygwin]\usr\X11R6\include (if required)
+
** tab "Resource compiler"
4.) If you want to create pure (native) win32 applications that do not require the Cygwin DLL you may add the following:
+
*** add [Cygwin]\usr\include
  - tab "Compiler" -> tab "Other options": add the compiler switch: -mno-cygwin
+
*** add [Cygwin]\usr\X11R6\include (if required)
  -> Please notice that some programs you are developing require specific
+
 
    unix functionality / libs that is provided only through the Cygwin layer.
+
* If you want to create pure (native) win32 applications that do not require the Cygwin DLL you may add the following:
    In that case this switch has to be removed.
+
** tab "Compiler" -> tab "Other options": add the compiler switch: -mno-cygwin
 +
-> Please notice that some programs you are developing require specific unix functionality / libs that is provided only through the Cygwin layer. In that case this switch has to be removed.
  
 
== Troubleshooting ==
 
== Troubleshooting ==
 
For troubleshooting enable the "Full command line" Under menu "Settings" -> "Compiler" -> "Other" tab, "Compiler logging". If you see that still the gcc compiler is invoked, make sure you setup the right compiler in the build options for your project '''AND''' your target (e.g. "default").
 
For troubleshooting enable the "Full command line" Under menu "Settings" -> "Compiler" -> "Other" tab, "Compiler logging". If you see that still the gcc compiler is invoked, make sure you setup the right compiler in the build options for your project '''AND''' your target (e.g. "default").

Latest revision as of 13:09, 26 January 2012

Attaching the compiler framework

Make sure that you have installed Cygwin at least with the GCC, G++ and GDB packages. This article describes the steps required to attach the GNU Cygwin Compiler suite.

In Code::Blocks under Settings->Compiler and debugger do the following:

  • Make a copy of the GNU GCC compiler as follows:
    • Goto menu "Settings" -> "Compiler"
    • Select the "GNU GCC Compiler", click the "Copy Button"
    • Save the copy e.g. under "Cygwin GCC Compiler"
  • Setup the compiler as follows:
  • Under the "Programs" tab:
    • point the path to your Cygwin installation folder
    • under "Additional path" add [Cygwin]\usr\X11R6\bin (if required)
    • under "Program files" setup the following for the executables:
    • (Note, The "-3" may need to be changed to "-4" in the following exe)
      • C Compiler: gcc-3.exe
      • C++ Compiler: g++-3.exe
      • Linker for dynamic libs: g++-3.exe
      • Linker for static libs: ar.exe
      • Debugger: gdb.exe
      • Resource compiler: windres.exe
      • Make program: make.exe
  • Under the "Directories" tab make sure to adjust the include/lib path's:
    • tab "compiler" (notice the "\usr" in contrast to the linker):
      • add [Cygwin]\usr\include
      • add [Cygwin]\usr\X11R6\include (if required)
    • tab "linker" (notice the missing "\usr" in contrast to the compiler):
      • add [Cygwin]\lib
      • add [Cygwin]\usr\X11R6\lib (if required)
    • tab "Resource compiler"
      • add [Cygwin]\usr\include
      • add [Cygwin]\usr\X11R6\include (if required)
  • If you want to create pure (native) win32 applications that do not require the Cygwin DLL you may add the following:
    • tab "Compiler" -> tab "Other options": add the compiler switch: -mno-cygwin

-> Please notice that some programs you are developing require specific unix functionality / libs that is provided only through the Cygwin layer. In that case this switch has to be removed.

Troubleshooting

For troubleshooting enable the "Full command line" Under menu "Settings" -> "Compiler" -> "Other" tab, "Compiler logging". If you see that still the gcc compiler is invoked, make sure you setup the right compiler in the build options for your project AND your target (e.g. "default").