Hey,
New member here because I haven't been able to find any good info on how to create C++ programs for the iPhone/iPod Touch.
I just want to make a simple "Hello, world!" programme on the iPod itself and <b>not</b> using the toolchain.
I found a thread discussing how to do it in C
Code:
//main.c
#include <stdio.h>
int main()
{
printf( "Hello, world!n" );
return 0;
}
then type into terminal
Code:
gcc main.c -o main
ldid -S main
chmod 0775 main
./main
and that works perfectly but when I try to make a C++ "Hello, world!" I get header errors.
Code:
// main.cpp
#include <iostream>
int main()
{
std::cout << "Hello, world!n" << std::endl;
return 0;
}
Now, when I type into terminal:
Code:
g++ main.cpp -o maincpp
I get the following errors;
Code:
main.cpp:1:20: error: iostream: No such file or directory
main.cpp: In function 'int main()':
main.cpp:5: error: 'cout' is not a member of 'std'
main.cpp:5: error: 'endl' is not a member of 'std'
Please could someone help me out with this problem as I want to learn how to program in C++ but because I have lots of homework during the evenings I don't get much time to use a C++ compiler on my desktop.
I would also prefer to code in C++ because I've already got to grips with the basics and don't really want to learn C.
Thanks.