c++ compiler

This is a discussion on c++ compiler within the C++ Programming forums, part of the General Programming Boards category; Hi, I have access to a unix machine and i have created a simple c++ program, 1st.cpp. But when i ...

  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    1

    c++ compiler

    Hi,
    I have access to a unix machine and i have created a simple c++ program, 1st.cpp.
    But when i tried to compile at command prompt using the below command
    g++ 1st.cpp it says

    ksh: g++: not found

    I also tried gcc 1st.cpp. But same error

    Does this means that i do not have c++ compiler on that machine or am I using a wrong command?

    Please advice.

    Also how do I know what machine/os(HP or Sun or RISC) I am in? Is there a unix command that gives me environment/system(Unix or Linux or AIX) information?

    Thanks for your help.

    Regards.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,235
    Quote Originally Posted by pgmr1 View Post
    Hi,
    I have access to a unix machine and i have created a simple c++ program, 1st.cpp.
    But when i tried to compile at command prompt using the below command
    g++ 1st.cpp it says

    ksh: g++: not found

    I also tried gcc 1st.cpp. But same error

    Does this means that i do not have c++ compiler on that machine or am I using a wrong command?
    Looks like the machine doesn't have GCC installed. It may have some other compiler available, though. Try "man -k compiler" to get a list of relevant man pages. If "man -k" does not work, try "apropos compiler"

    Also how do I know what machine/os(HP or Sun or RISC) I am in? Is there a unix command that gives me environment/system(Unix or Linux or AIX) information?
    The "uname" command gives this sort of information. You may need to use certain switches to get the level of detail you want. See "man uname"
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User
    Join Date
    Oct 2006
    Posts
    2,294
    I definitely recommend reading the man page, but on all unix systems I've seen, uname -a returns basically everything to identify the OS.

  4. #4
    Registered User
    Join Date
    Dec 2006
    Location
    Canada
    Posts
    3,167
    Have you tried "cc" (instead of gcc, for C) and "c++" (instead of g++, for C++)? They should be linked to the default compiler.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  2. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  3. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 05:42 AM
  4. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 10:28 AM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM

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