Friday, March 04, 2016

2016-03-04 Friday - GCC, The GNU Compiler Collection

Today I've spent time setting-up my Windows 10 development environment to be able to work with GCC, the GNU Compiler Collection - and integrating that into my Eclipse IDE.

1.0 Cygwin Setup

At the time of this writing Cygwin 2.4 was the latest available

The Cygwin documentation may be of help, if you are not familiar with it

See: Using GCC with Cygwin
There are a number of packages that you'll want to select for installation - that are not auto-selected in the default (Base package) Cygwin installation configuration:

  • Here are some additional packages that I either selected to be installed for my setup - or were added as dependencies of packages I selected...
    • Admin
      • libattr1
    • Archive
      • bzip2
      • libarchive13
      • libbz2_1
      • xz
    • Base
      • (take the defaults)
    • Database
      • libdb5.3
      • libmysqlclient18
      • libsqlite3_0
    • Devel
      • autoconf2.5
      • binutils
      • bison
      • byacc
      • cccc
      • clang
      • clang-analyzer
      • clisp
      • cmake
      • cmake-doc
      • cppunit
      • cygwin-devel
      • dmalloc
      • flex
      • gcc-core
      • gcc-g++
      • gcc-objc
      • gcc-objc++
      • gdb
      • libargp
      • libcloog-isl4
      • libtdll7
      • make
      • mcpp
      • patch
      • patchutils
      • w32api-headers
      • w32api-runtime
      • windows-default-manifest
    • Doc
      • clang-doc
      • cygwin-doc 
    • Interpreters
      • clisp
      • gawk
      • libguile17 
      • m4
      • perl
      • perl_autorebase
      • pre_base
      • python
    • lib
      • libargp
      • libatomic1
      • libattr1
      • libblkid1
      • libclang3.7
      • libclog-isl4
      • libcrypt0
      • libcurl4
      • libedit0
      • libexpat1
      • libffi6
      • libgcc1
      • libgdbm4
      • libgmp10
      • libgomp1
      • libssapi_krb5_2
      • libiconv
      • libiconv2
      • libidn11
      • libintl8
      • libisl10
      • libisl13
      • lib5crypto3
      • libkrb5_3
      • libkrb5support0
      • libllvm3.7
      • liblzma5
      • liblzo2_2
      • libmcpp0
      • libmpc3
      • libmpfr4
      • libncursesw10
      • libnettle4
      • libnghttp2_14
      • libobjc4
      • libopenldap_2_4_2
      • libopenssl100
      • libp11-kit0
      • libpcre1
      • libpipeline1
      • libpsl5
      • libquadmath1
      • libreadline7
      • libsigsegv2
      • libsmartcols1
      • libsqlte3_0
      • libssp0
      • libstdc++6
      • libtasn1_6
      • libunistring2
      • libuuid-devel
      • libuuid1
      • libvtv0
      •  libxml2
      • p11-kit
      • p11-kit-trust
      • popt
      • zlib0
    • Math
      • clisp
      • libgmp10
      •  libmpc3
      • libmpfr4
    • Net
      • ca-certificates
      • curl 
      • libopenldap2_4_2
      • libssh2_1
      • libtasn1_6
      • openssl
    • Perl
      • perl
      • perl_autorebase
      • perl_base 
    • Python
      • python
    • Shells
      • bash
      • clisp
      • dash
      • mintty
    • System
      • libattr1
      • libcom_err2
      • rebase
    • Text
      • groff
      • less
      • patchutils
    • Utils
      • diffutils
      • libssal2_3
      • patchutils
      • rebase


2.0 Eclipse CDT

At the time of this writing, CDT 8.8.1 was the latest available.

You can install the CDT version of Eclipse by downloading from here:
 
If you have an existing Eclipse environment already setup, and you just want to add the CDT plugins - you can add this p2 software repository link via the Help > Install New Software menu option

If you will be using Cygwin GCC compilers, then you'll probably want to make it your default:




You'll eventually need to debug something, so check to see that you have the correct debugger installed and configured properly for CDT:


Doug Schaefer is co-head of the Ecllipse CDT project - and has a few blog posts that may be of interests to CDT users


3.0 GCC, The GNU Compiler Collection References

4.0 Success! Code Compiled (...and ran)


5.0 Debugging

You'll need to setup a Debug profile for your program, and specify the executable - and source file





 Set your breakpoints, and begin a debugging session...



6.0 Additional References

If you run into an issue such as "Symbol 'cout' could not be resolved", or "Symbol 'std' could not be resolved" - you may need to manually add the appropriate Cygwin include directories, select the correct toolchain entry, and try closing and opening the project. These links were helpful to me in resolving this issue:




No comments: