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.

just started c++ xcode help


Post Reply New Thread Subscribe

 
Thread Tools
BBMike

 
Member Since: Dec 27, 2007
Posts: 27
BBMike is on a distinguished road

BBMike is offline
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?
QUOTE Thanks
mbgaski

 
Member Since: May 10, 2007
Posts: 17
mbgaski is on a distinguished road

mbgaski is offline
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.
QUOTE Thanks
BBMike

 
Member Since: Dec 27, 2007
Posts: 27
BBMike is on a distinguished road

BBMike is offline
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'
QUOTE Thanks
RNDdave

 
RNDdave's Avatar
 
Member Since: Sep 04, 2006
Location: Bristol, UK
Posts: 1,055
RNDdave is a jewel in the roughRNDdave is a jewel in the roughRNDdave is a jewel in the rough
Mac Specs: Alu MacBook | iPod Classic | iPod Shuffle | iPad2 (3G)

RNDdave is offline
Textedit is pretty good for simple text and a little bit more. Smultron is a pretty cool free app thats prob worth the download.
QUOTE Thanks
BBMike

 
Member Since: Dec 27, 2007
Posts: 27
BBMike is on a distinguished road

BBMike is offline
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
QUOTE Thanks
RNDdave

 
RNDdave's Avatar
 
Member Since: Sep 04, 2006
Location: Bristol, UK
Posts: 1,055
RNDdave is a jewel in the roughRNDdave is a jewel in the roughRNDdave is a jewel in the rough
Mac Specs: Alu MacBook | iPod Classic | iPod Shuffle | iPad2 (3G)

RNDdave is offline
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
QUOTE Thanks
BBMike

 
Member Since: Dec 27, 2007
Posts: 27
BBMike is on a distinguished road

BBMike is offline
thank you very much! now i can view my program..it works

thanks again
QUOTE Thanks
chat19

 
chat19's Avatar
 
Member Since: Aug 09, 2007
Posts: 115
chat19 is on a distinguished road
Mac Specs: MacBook Pro 2.4 GHz, 160 gig HDD @ 5400, 2 gig RAM, nVIDIA 8600

chat19 is offline
nice, but complex

"We, the Chinese people, draft the entire Woo-Tang Clan!"
QUOTE Thanks
JeTSpice

 
Member Since: Mar 25, 2008
Posts: 1
JeTSpice is on a distinguished road

JeTSpice is offline
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>
QUOTE Thanks
raydot

 
Member Since: Mar 27, 2008
Posts: 18
raydot is on a distinguished road

raydot is offline
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!
QUOTE Thanks

Post Reply New Thread Subscribe


« Automator or Scripting HELP! | Old XCode and 3.0? »
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
Xcode 1.5 alejandrico OS X - Development and Darwin 0 06-03-2006 05:56 PM
Features I miss from Visual Studio, now using xCode... RChickenMan OS X - Development and Darwin 0 10-18-2005 11:14 AM
Xcode doesn't run application correctly dr_springfield OS X - Development and Darwin 5 04-06-2004 11:22 PM
New Xcode plug-in helps developers reuse code Murlyn OS X - Development and Darwin 0 11-10-2003 12:16 PM
Xcode developer tools updated Murlyn OS X - Development and Darwin 0 11-04-2003 05:09 PM

All times are GMT -4. The time now is 07:18 PM.

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?