3

I have no C++ experience and want to learn. I have XCode but the IDE confuses me and seems far too advanced for my current level.

I'm starting with this http://www.cplusplus.com/doc/tutorial/program_structure/

// my first program in C++

#include <iostream>
using namespace std;

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

I entered it into SublimeText2 using the C++ formatting and then saved the file in

Ryan>Desktop>ApplicationDevelopment>Sandbox as helloworld.cpp

I have XCode installed and found How to run C/C++ in a Unix console/Mac terminal?

I went to terminal, navigated to the directory it is in and tried:

make helloworld.cpp

It returned:

make: Nothing to be done for 'helloworld.cpp'

Update, hopefully the below formatting is clear

$ g++

i686-apple-darwin10-g++-4.2.1: no input files

$ g++ helloworld.cpp -o outputname.bin

$ (nothing returned)

$ g++ helloworld.cpp helloApp ./helloApp

i686-apple-darwin10-g++-4.2.1: helloApp: No such file or directory

i686-apple-darwin10-g++-4.2.1: ./helloApp: No such file or directory

$ g++ helloworld.cpp -o helloApp ./helloApp

ld: in ./helloApp, can't link with a main executable

collect2: ld returned 1 exit status

Community
  • 1
  • 1
Ryan
  • 699
  • 4
  • 13
  • 30

0 Answers0