Thread: Eclipse with Ubuntu

  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    33

    Eclipse with Ubuntu

    Hi I m doing a work with Ubuntu using Eclipse for my thesis' project. I need to insure the compiler is generating the maximum number of warnings, that I fix all warnings and stop using any compiler specific "feature", such as VLAs. Do you know how can I?


  2. #2
    Registered User
    Join Date
    Nov 2010
    Location
    Long Beach, CA
    Posts
    5,909
    That all depends on which compiler you are using. Eclipse is just an IDE (basically a code editor with an interface to a compiler and debugger). You would have to check the Eclipse settings to find out what compiler you are using, I think the default is GCC, but I'm not sure. Once you know the that, you look up the documentation for that compiler, to find out how to turn the warnings up to the max, and how to enable/disable certain features, such as adherence to a particular standard.

    For GCC, some useful flags are
    -Wall enable all warnings
    -Werror treat warnings as errors, i.e. a warning will cause compilation to fail, instead of merely outputting a message
    -std=c89|c99 use the 1989 or 1999 version of the C standard (yes, there's a C11 standard from 2011, but I'm not sure how much support GCC has for it)
    -pedantic be very picky about adhering to the standard, no compiler-specific extensions
    -pedantic-errors same as -pedantic, but generates errors (compilation fails) instead of warnings (messages only). Not sure if you need this when using -Werror

    That being said, VLAs are not a "compiler specific feature". They were added to the C standard in 1999 (find a copy of the standard here: C Draft Standards).

    This just came up in another thread recently, but VLAs were broken in GCC through version 4.4. They are working in 4.6+ however. You can find which C99 features are supported in GCC 4.6 here (modify the URL as needed for your version): Status of C99 features in GCC 4.6 - GNU Project - Free Software Foundation (FSF). Note, if you're using an version older than 4.6, consider upgrading (4.6 is already 2 years old).

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you create a "makefile" project, then all the compiler rules go in the makefile, and you can control all the flags to your own requirements.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Eclipse CDT & curses
    By sbaginov in forum Linux Programming
    Replies: 16
    Last Post: 01-05-2011, 09:46 PM
  2. install eclipse
    By manish411 in forum C++ Programming
    Replies: 1
    Last Post: 06-17-2010, 07:59 AM
  3. running eclipse for c and c++
    By manish411 in forum Windows Programming
    Replies: 3
    Last Post: 06-11-2010, 10:27 AM
  4. Eclipse C++ problem
    By Nextstopearth in forum Tech Board
    Replies: 8
    Last Post: 04-05-2009, 12:37 AM
  5. a problem about the use of eclipse
    By ChrisWang in forum C++ Programming
    Replies: 6
    Last Post: 06-28-2008, 11:19 AM