Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

C++ compiler needed (free is nice

  1. Jan 8, 2009 #1
    C++ compiler needed (free is nice:)

    So I am taking a very basic (no pun) programming course at my university. We are working in C++ for now and we use Microsoft Visual Basic C++ 6.0 (or something to that effect).

    I live waayyy off campus, so I would like to be able to work at home if necessary as opposed to hanging out all day in the computer lab.

    Is there a C++ compiler that is:

    a) free

    b) Operates in the same exact way as MS Visual

    c) Will allow me to save a program and then open it with MS Visual

    ?

    Sorry if these are silly questions, but this is my first experience with programming.

    Casey
     
  2. jcsd
  3. Jan 8, 2009 #2

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    The express edition of Microsoft Visual studio is free (all languages) http://www.microsoft.com/express/vc/

    The compiler doesn't do all the performance optomisations of the pro one but is otherwise identical, you have to manually download some extra SDKs to do certain kinds of windows programming but for general learning C++ it is great.

    There is also the excellent GCC compiler for windows http://www.mingw.org/
    But if you want an IDE you will need to something like eclipse http://www.eclipse.org/
     
  4. Jan 8, 2009 #3
    Re: C++ compiler needed (free is nice:)

    Note that the interplay of Visual C++ 6.0 with the current version of Visual C++ is sub optimal. In particular, since VC++ 6.0 was such a dog you may find that VC++ 2008 sometimes has problems importing projects generated with VC++ 6.0. Moreover, if you find yourself doing anything vaguely related to technical/scientific computing with VC++ 6.0, get ready to learn an awful lot about pragmas...

    You might find it worth your while having a word with whoever's giving your class and telling them that the current (Express) version of Visual C++ is both free and much, much better than VC++ 6.0. It would make an awful lot more sense to give a class based on the newer, better version than a ten year old piece of crap.
     
  5. Jan 8, 2009 #4
    Re: C++ compiler needed (free is nice:)

    dev c++ is another one you might be interested in, its a complete IDE like visual studio.
     
  6. Jan 9, 2009 #5
    Re: C++ compiler needed (free is nice:)

    That free MS Visual trial looks perfect! Thanks! I think 90 days should be right on schedule since we then move on to MATLAB.

    Thanks for all the input guys :smile:

    Casey
     
  7. Jan 9, 2009 #6

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    The MS one isn't a trial - if you download the EXPRESS edition it's totally free.
     
  8. Jan 12, 2009 #7
    Re: C++ compiler needed (free is nice:)

    Okay... where the HELL is the execute command/button in Visual Express? Am I retarded or something?

    I have been looking for like 30 minutes now :rofl:
     
  9. Jan 12, 2009 #8

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    F5 / ctrl-F5 ? or debug->start->without debugging
    Or at least it is in pro
     
  10. Jan 13, 2009 #9
    Re: C++ compiler needed (free is nice:)

    I cannot get it to work. It's weird; I click "start w/out debugging" and a dialogue box appears that asks me to "pick something executable file..." and there is a drop box with only one option.

    I did not want to mess with it since it looked like something registry-related.

    What happened to a simple red exclamation point?

    Also, the "Help" section is a nightmare. I am going to watch a tutorial when I get time.
     
  11. Jan 13, 2009 #10

    Borek

    User Avatar

    Staff: Mentor

    Re: C++ compiler needed (free is nice:)

    Strange. If you have a properly created project (it is called a solution now, or something, I am still thinking in terms of VStudio 6.0) F5 or Ctrl-F5 should either start the program, or ask if you want to make it if there is no up to date exe.

    Perhaps you have just opened some source without creating a project?
     
  12. Jan 13, 2009 #11

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    In the project setup (project menu->properties or right click on the project in the tree)
    Then Configuration properties->Debugging
    The 'Command' should be $(TargetPath)
    Also check the 'Output file' setting in Linker->General

    If it's missing it will ask you for the executable to run.
     
  13. Jan 13, 2009 #12
    Re: C++ compiler needed (free is nice:)

    Hmm. Still having trouble; sorry, this is my first time with any programming software :smile:

    I have my program written in an open project.
    I have "built" it and there are zero errors.

    That info you told me to check looks like this (I had to put in the "$(TargetPath)") Is it really supposed to say that? Or am I supposed to replace "Target path" with something?:blushing:

    [​IMG]
    [​IMG]

    Now when I hit "Start w/out debugging I get this:
    [​IMG]

    Then I am lost again :smile:

    Thanks for your help thus far, I appreciate it!
     
  14. Jan 13, 2009 #13

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    You are building a DLL (a shared library) not an executable.

    If you want an executable set
    Configuration properties->General
    Configuration type = Application (.exe)

    I'm surprised it let you build a dll with a main() without complaining ?
     
  15. Jan 13, 2009 #14
    Re: C++ compiler needed (free is nice:)

    Awesome! Thanks so much!

    So will I need to change all of that stuff ($(TargetPath)", (Application(.exe))
    every time I start a new project?

    Or will it default to that from now on?
     
  16. Jan 13, 2009 #15

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    It will be filled in automatically.
    When you start a new project it asks you if you want to create a console app, windows app, dll etc.
     
  17. Jan 13, 2009 #16
    Re: C++ compiler needed (free is nice:)

    Okay. My problem is I really just do not know what I am doing.

    Here is a really stupid program I just wrote; I am sure there are errors, but that is not important:

    #include <iostream>;
    using namespace std;

    int main()
    {
    double x1 (1), x2 (2);
    y = x2-x1;

    cout <<"y is " << y;

    return (0)
    }

    Now if I want to open Visual Studio and paste that into an environment where it will work, what is the correct file path?

    When I click File-->new project

    these are my options:

    [​IMG]
     
  18. Jan 13, 2009 #17

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    Select win32->win32 console project
    It will just make a regualr .exe that you can run on the command line (or from visual studio)

    It will create an empty project with a file called "name_of_project.cpp" containing just

    int _tmain(int argc, _TCHAR* argv[])
    {
    return 0;
    }

    You can replace this with the normal main(...) it's just some windows redefines for historical reasons.


    CLR is C++ but running ontop of the .Net - a whole level of complexity you want to avoid!
     
  19. Jan 13, 2009 #18
    Re: C++ compiler needed (free is nice:)

    :rofl: Sorry, but there is win32--> and my options are "Win32 Console Application" or "Win32 Project"

    There is no "win32 console project"

    Thanks!
     
  20. Jan 13, 2009 #19

    mgb_phys

    User Avatar
    Science Advisor
    Homework Helper

    Re: C++ compiler needed (free is nice:)

    Sorry meant application (was doing it from memory)

    [​IMG]
     
  21. Jan 13, 2009 #20
    Re: C++ compiler needed (free is nice:)

    Sweet! Thank you :smile:
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?



Similar Discussions: C++ compiler needed (free is nice
  1. C++ compilers (Replies: 24)

Loading...