The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
.
google unix.com



High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
UNIX newbie NEWBIE question! Hanamachi UNIX for Dummies Questions & Answers 4 03-28-2009 04:10 PM
Can u help a newbie? bLinQue UNIX for Dummies Questions & Answers 2 07-16-2004 01:27 PM
newbie needs help goodman UNIX for Dummies Questions & Answers 1 01-25-2002 10:50 AM
help<newbie> skistar High Level Programming 9 01-18-2002 06:12 PM
NEWBIE << help >> LolapaloL High Level Programming 1 11-13-2001 01:02 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-20-2002
<Therapy> <Therapy> is offline
Registered User
  
 

Join Date: Jan 2002
Location: Sweden
Posts: 14
Question Newbie Q

What is the comand to compile a c++ code in Unix. I have only used Borland C++ on win but have heard that UNIX has a integrated compiler.
  #2 (permalink)  
Old 03-20-2002
killerserv's Avatar
killerserv killerserv is offline Forum Advisor  
Unix Predator
  
 

Join Date: Dec 2000
Location: Phoenix, AZ
Posts: 670
Yes there is a compiler in Unix, its called g++

g++ [option | filename ]

g++ is a script to call gcc with options to recognize C++. gcc processes input files through one or more of four stages: prepro-cessing, compilation, assembly, and linking.

C++ source files use one of the suffixes `.C', `.cc',`.cxx', `.cpp', or `.c++'; preprocessed C++ files use the suffix `.ii'

In g++ options must be separate: "-dr " is quite different from `-d -r ' and so on..

For more information check your g++ man pages
  #3 (permalink)  
Old 03-20-2002
<Therapy> <Therapy> is offline
Registered User
  
 

Join Date: Jan 2002
Location: Sweden
Posts: 14
Cool Cool!

Thanks for your help! I hope that i some day can say that I know UNIX...
  #4 (permalink)  
Old 03-20-2002
<Therapy> <Therapy> is offline
Registered User
  
 

Join Date: Jan 2002
Location: Sweden
Posts: 14
Error message

I tried to run g++ ut got an error about <iostream.h>

As I understod it is supposed to be located in /usr/include but it is not there. Have i got it wrong?

The error msg I got is:

hello.cpp: In function `int main ()':
hello.cpp:5: no match for `_IO_ostream_withassign & = const char[13]'
/usr/include/g++-3/iostream.h:243: candidates are:
_IO_ostream_withassign &_IO_ostream_withassign:perator= (ostream &)
/usr/include/g++-3/iostream.h:245:
_IO_ostream_withassign &_IO_ostream_withassign:perator=
(_IO_ostream_withassign &)


and the source code is:

#include <iostream.h>

main ()
{
cout >>"Hello World\n";

return 0;
}

Last edited by <Therapy>; 03-20-2002 at 08:24 AM..
  #5 (permalink)  
Old 03-20-2002
<Therapy> <Therapy> is offline
Registered User
  
 

Join Date: Jan 2002
Location: Sweden
Posts: 14
Exclamation Error

Ok, now I do got error:

hello.cpp: In function `int main ()':
hello.cpp:5: `cout' undeclared (first use this function)
hello.cpp:5: (Each undeclared identifier is reported only once for each
function it appears in.)

`cout' undeclared? I don't get this....

  #6 (permalink)  
Old 03-20-2002
<Therapy> <Therapy> is offline
Registered User
  
 

Join Date: Jan 2002
Location: Sweden
Posts: 14
Smile Got it working

Finally I got it working!
Feels quite embarrasing to put the error from one of the most simple program ever on the web. ut for all newbies - Watch ad learn.

The rigth code is:

#include <iostream.h>

int main()
{
cout << "Hello World!\n";

return 0;
}


Take care!
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:27 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0