just started c++ xcode help

Joined
Dec 27, 2007
Messages
27
Reaction score
0
Points
1
hey people im in grade 12 and just a few days ago we started c++
at school we use dev++ and it seems pretty easy.. type your code.. compile and run..

i downloaded xcode tools and it seems very complicated.. i did create new c++ and i can type the code but there are no options to compile and run it.. why?
 
Joined
May 10, 2007
Messages
17
Reaction score
0
Points
1
Are you looking to specifically compile GUI applications or just work on your programming stuff from school on your Mac?

If the latter, you can easily do this without having to mess with Xcode (which can be daunting for someone just getting into programming).

Just open up any old text editor (I like Simultron on Mac) and write your code, then save it. Open a Terminal window, navigate to where you saved your filed, and then type:

g++ filename.cpp

That should produce an a.out binary that you can run by typing ./a.out

I'd play around with plain old text based C++ a lot before getting deep into GUI programming. I'm still not very good with Xcode myself, but I have done GUI development for Windows on Borland C++ Builder and having the plain-jain background foundation in place helped a lot there.
 
OP
B
Joined
Dec 27, 2007
Messages
27
Reaction score
0
Points
1
i simply want to work on my school projects on my mac.. we learned the language Turing for two years and then the final year of highschool we moved to c++..

its simple stuff like

cout >> "enter a number";
cin << number;


i was hoping xcode can be a nice alternative for dev++ but i guess its not?
i'll try that method and i'll update you later if it works

by the way is there a built in text editor on the mac? i know there's textedit but thats more like a word style application.. im talking pure 'notepad'
 
Joined
Sep 4, 2006
Messages
1,063
Reaction score
69
Points
48
Location
London, UK
Your Mac's Specs
MacBook Air | iPad | iPhone | iPod Classic | iPod Shuffle | no more money
Textedit is pretty good for simple text and a little bit more. Smultron is a pretty cool free app thats prob worth the download.
 
OP
B
Joined
Dec 27, 2007
Messages
27
Reaction score
0
Points
1
alright

also.. i opened terminal for the first time and how the heck do i navigate through it

im a new mac user.. i tried to type DIR to see all directories and but that doesnt work..

my file is located on my desktop so i somehow need to reach it
 
Joined
Sep 4, 2006
Messages
1,063
Reaction score
69
Points
48
Location
London, UK
Your Mac's Specs
MacBook Air | iPad | iPhone | iPod Classic | iPod Shuffle | no more money
to change directory the command is cd
to view the contents then the command would be ls
to view where you are type pwd

If you type man ls you should get the full list of options available to you and what they mean.

When you open the terminal it should default to your user area so just typing cd desktop should be all you need to get to the desktop

EDIT: a quick Google search brought up a page with plenty of commands for you to play with in the terminal terminal commands
 
OP
B
Joined
Dec 27, 2007
Messages
27
Reaction score
0
Points
1
thank you very much! now i can view my program..it works

thanks again :)
 
Joined
Aug 9, 2007
Messages
115
Reaction score
2
Points
18
Your Mac's Specs
MacBook Pro 2.4 GHz, 160 gig HDD @ 5400, 2 gig RAM, nVIDIA 8600
nice, but complex
 
Joined
Mar 25, 2008
Messages
1
Reaction score
0
Points
1
I'm doing the same thing, but when I type

g++ TestC2.cpp

I get an error:

TestC3.cpp:3: error: 'cout' was not declared in this scope

What am I doing wrong?

Here's my code:

int main ()
{
cout << "Hello World.";
return 0;
}

Edit: Just fixed it. Accidentally erased #include <iostream>
 
Joined
Mar 27, 2008
Messages
18
Reaction score
2
Points
3
If anyone's still following, the Terminal runs a brand of Unix (which one depends on how your computer is configured). Any basic primer on using a Unix command line will explain how to "use" the terminal.

Also, there's a great editor included with the terminal called Emacs, type "emacs" at the prompt to start it up. If you are patient and willing to read the manual you can figure out how to write and compile code all from the same window.

Good luck!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top