Which editor/compiler should I get?

This is a discussion on Which editor/compiler should I get? within the C++ Programming forums, part of the General Programming Boards category; Hi guys I am considering dipping my toes into some C++ programming, and I'm sure I will have much fun ...

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    3

    Which editor/compiler should I get?

    Hi guys
    I am considering dipping my toes into some C++ programming, and I'm sure I will have much fun with the tutorials on this site. My question however is which editor/compiler should I use? I would prefer that I would be able to compile my code for windows, Linux and Mac's (intel and powerPC based) (is that even possible/feasible?). I have no idea of whether all (or any) editors/compilers can do this? The first of the tutorials mentions that there are several "dialects" of C++ will this influence on whether my code can be compiled for the different OS's?

    Thanks

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,318
    To compile code for each of those machines, you have to actually run a compiler on each machine. There are compilers and/or IDEs that have versions for each of those platforms, so if you want to be able to develop code on each system then you might want to look into that for consistency.

    If you just need to write code that could be compiled on different platforms, then you just have to write portable code. Any modern C++ compiler should be able to let you write good portable C++.

    So will you be actually writing/developing the code on all those platforms? If not, which platform will you be using?

    >> The first of the tutorials mentions that there are several "dialects" of C++
    I've never heard of this. Which tutorial are you using? Perhaps the context of the statement will make it clearer.

  3. #3
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    There's compiler-specific extensions, which could, with some imaginations, be called dialects. But not really dialects as you typically find in very early stages of languages - Lisp, for example, had many dialects, some of which finally evolved into proper languages.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  4. #4
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    There is an ANSI/ISO C++ language standard. If you write code to that standard, you are writing portable code that can be re-compiled for any machine for which you have a compiler.

    Most beginning C++ books & classes will teach ANSI/ISO C++, or hopefully something close to it. If you are planning to write portable code, you should get a book that sticks to ANSI/ISO C++, and take care to learn what is, and what is not, standard.

    However, there is a big issue with the language standard. Any "pure C++" program will run on a simple system with a monochrome text display and keyboard. So, there is no color, graphics, mouse, sound, or networking in ANSI/ISO C++.

    Most modern compilers can do all of this stuff, but it's done with additional non-standard (generally non-portable) libraries. In C++, these are generally considered advanced topics, and if you were taking C++ in college, they would be covered in a 2nd, or 3rd class. (Even without those features, C++ is a complex language with lots of features.)

    Most real-world programs contain some non-standard (non-portable) code. If you are writing a multi-platform program, it's best to keep the standard and non-standard code in separate source files.

    There are cross-platform libraries, such as the wxWidgets GUI library, and these tools can make multi-platform programming more managable. (I didn't say easy... GUI programming for a single platform is not easy!)

    Another cross-platform option is Java. I've never programmed in Java, but it's syntax/format is similar to C++, it's also object oriented, and graphics/GUI are part of the portable standard.


    This has nothing to do with what you are doing, but there is also something called a cross-compiler. A cross-compiler runs on one machine, but generates code that runs on another. These are commonly used to program embedded systems. If you were writing code for a car's engine controller, you would typically run a special-purpose cross-compiler (and IDE) on your PC, that generates code for the particular microcontroller. (I don't think you will find a cross-compiler that runs on a PC, and generates code for the Mac or Linux.)
    Last edited by DougDbug; 11-15-2007 at 08:04 PM.

  5. #5
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    I don't think you will find a cross-compiler that runs on a PC, and generates code for the Mac or Linux.
    Yeah, you will. There are cross-compiling variants of Cygwin's GCC. They're just difficult to find - you might even have to compile them yourself.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  6. #6
    Registered User
    Join Date
    Nov 2007
    Posts
    3
    Quote Originally Posted by Daved View Post
    I've never heard of this. Which tutorial are you using? Perhaps the context of the statement will make it clearer.
    The first of the tutorials on right here on Cprogramming.com link

    Anyway thanks guys this has really given me some food for thought. I did not realize that the GUI bit of C++ was not really portable (although I was wondering how it would have worked). Since my main OS is Windows I guess i will start out with a compiler for windows and if I get some coding done that I will want to port I will have to work out how to do that later. For now I think I just need to learn some basic C++ skills.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    7,318
    >> The first of the tutorials on right here on Cprogramming.com
    I wouldn't use the term "dialects" in that instance. I also think it is overstating the significance of the differences in compiler extensions and non-standard libraries.

    If you stick to standard C++, then your compilers should pretty much all be able to handle it equally. If you stick to libraries that are portable for your non-standard stuff, then you should still be ok.

    Also, note that there is no GUI in standard C++. To do GUIs you have to use libraries that don't come as part of the language. However, there are portable GUI libraries. For example, the wxWidgets library DougDbug mentioned is portable to windows, mac and Linux. So just because your main OS is Windows doesn't mean that you can't start with portable GUI code.

    As far as a compiler/IDE, I'd recommend VC++ 2005 Express if you're really serious about programming. Code::Blocks and Dev-C++ are also popular and free. You might consider the wx version of Dev-C++ since the other version is no longer being maintained.

  8. #8
    Registered User
    Join Date
    Nov 2007
    Posts
    3
    Ahhh things are starting to fall into place for me. Thanks a lot!!

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    230
    TextPad is a really good text editor. It has all the basic features (syntax highliting, code indenting, etc.). However it does not feature code completion.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Editor/Compiler question
    By BuzzBuzz in forum C++ Programming
    Replies: 4
    Last Post: 04-02-2009, 02:43 PM
  2. C Text Editor/Compiler
    By CJ7Mudrover in forum C Programming
    Replies: 7
    Last Post: 03-07-2004, 04:31 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21