The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

2.2 Unlock / Jailbreak OS X | Discuss AppStore Apps | Browse / Search Cydia | MMi Cydia Stats




  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion
Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-29-2008, 08:23 PM
What's Jailbreak?
 
Join Date: Oct 2008
Device + Firmware: iPod Touch 2.1 Pwned
Operating System: XP & Vista
Location: Northern Ireland
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Hello, world! in C++ Dilemma

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.

Last edited by decky1990; 10-30-2008 at 04:01 AM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2 (permalink)  
Old 10-31-2008, 08:23 AM
What's Jailbreak?
 
Join Date: Oct 2008
Device + Firmware: iPod Touch 2.1 Pwned
Operating System: XP & Vista
Location: Northern Ireland
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

Come on people, there are bound to be some good programmers out there who can help me.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #3 (permalink)  
Old 11-03-2008, 02:07 PM
iPhone? More like MyPhone
 
Join Date: Oct 2007
Posts: 106
Thanks: 2
Thanked 17 Times in 14 Posts

Clearly you are missing STL header files.

Once you install the missing headers, you have to ckeck if the lib is installed.
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #4 (permalink)  
Old 11-04-2008, 11:07 AM
What's Jailbreak?
 
Join Date: Oct 2008
Device + Firmware: iPod Touch 2.1 Pwned
Operating System: XP & Vista
Location: Northern Ireland
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

the standard library files are not missing they are just in other subfolders within /var/include

Problem is whenever I try to link the compiler to the directory I get everlasting errors. The compiler finds iostream alright when I link it using the -I"/var/include/c++/4.0.0/" option but it can't find the header files stated within iostream.

Another question: am I searching for iostream or iostream.h? And which compiler should I be using e.g. gcc, c++, g++, arm-apple-darwin9-g++ etc?
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
Reply

  Apple Forums & iPhone Forums, Mods, Hacks, News, Themes, Downloads, and more! | ModMyi.com > 3rd Party Apps For iPhone | iPod Touch > iPhone / iPod Touch SDK | Development Discussion

Tags
c++, error, hello world, iostream

Thread Tools
Display Modes

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 On

Forum Jump


Go to Top
ModMyI

All times are GMT -6. The time now is 07:33 AM. Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0 | Dedicated Server Hosting by SingleHop | Copyright © 2007-09 by ModMy, LLC. All rights reserved.

RSS / Contact Us / / ModMyi Home / Archive / Privacy Statement / Top


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122