New To Mac-Forums?

Welcome to our community! Join the discussion today by registering your FREE account. If you have any problems with the registration process, please contact us!

Get your questions answered by community gurus Advice and insight from world-class Apple enthusiasts Exclusive access to members-only contests, giveaways and deals

Join today!

 
Start a Discussion
 

Mac-Forums Brief

Subscribe to Mac-Forums Brief to receive special offers from Mac-Forums partners and sponsors

Join the conversation RSS
OS X - Development and Darwin Discussion and questions about development for Mac OS X.

C++ in terminal


Post Reply New Thread Subscribe

 
Thread Tools
frike

 
Member Since: Apr 01, 2008
Posts: 9
frike is on a distinguished road

frike is offline
Hi everyone,

I'm really new to everything, I just started using the terminal about a week ago and yesterday I started a c++ course in uni.
I'm don't even know if this is the right forum but my terminal says "Welcome to Darwin" so I figured the clue is in the title...

I'd like to try the things we do at uni at home with my mac, but I have a few problems getting everything to run.

At uni we use solaris and also work via a terminal.

To open a new file with an editor we either type
gvim filename.cc
or
emacs filename.cc

emacs also opens in the terminal, but it looks really different and I can't figure out how to save a file or anythiing else for that matter (please don't laugh..)

I think I managed to somehow create a file anyhow, but I can't compile the program with g++ (in uni we just use
g++ -c filenam.cc)

I've read that there is supposed to be some gcc compiler in the terminal, but how does it work?

I'd really like to use the terminal for these things and I don't want to get started with xcode yet, because I want to keep things similar to what we do at uni.

Any help would be much appreciated!

-frike
QUOTE Thanks
novicew

 
novicew's Avatar
 
Member Since: Jan 04, 2006
Location: Hamburg, Germany
Posts: 1,385
novicew is a name known to allnovicew is a name known to allnovicew is a name known to allnovicew is a name known to allnovicew is a name known to allnovicew is a name known to allnovicew is a name known to all
Mac Specs: MacBook Pro | iMac(2.1 G5) | MacBook(2.16 C2D) | MacMini (1.67 CD) | iPhone 4 | iPad (3rd Gen)

novicew is offline
Check whether you have g++ compiler installed.
Open the Terminal, type g++ -v and hit return.
This should provide you information on g++. If it is not giving any output, install xCode. That should provide all the tools that you need.

To compile helloworld.cc
g++ helloworld.cc -o helloworld (this will create an executable file with the same name)
./helloworld (this should execute the helloworld)
QUOTE Thanks
frike

 
Member Since: Apr 01, 2008
Posts: 9
frike is on a distinguished road

frike is offline
Thanks
The compiler wasn't installed. It's working fine now.
QUOTE Thanks

Post Reply New Thread Subscribe


« how are "etext" and "end" defined on Darwin?? | Installing GCC 4.3 »
Thread Tools

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
Forum Jump

Similar Threads
Thread
Thread Starter
Forum
Replies
Last Post
Terminal Commands for Hidden Settings in Leopard goobimama OS X - Operating System 2 12-03-2007 11:38 AM
Terminal problems please help CliveO OS X - Operating System 6 03-20-2007 11:04 AM
Terminal Problem WROC OS X - Apps and Games 5 01-09-2007 05:01 PM
Terminal Help rs2sensen OS X - Apps and Games 1 04-25-2005 11:52 PM
Terminal nbizm 3 for the price of 1 Bo Eddy OS X - Development and Darwin 5 05-04-2004 01:40 PM

All times are GMT -4. The time now is 02:59 AM.

Powered by vBulletin
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
X

Welcome to Mac-Forums.com

Create your username to jump into the discussion!

New members like you have made this community the ultimate source for your Mac since 2003!


(4 digit year)

Already a member?