The ModMyTM Family of Sites:
ModMyMotoModMyiModMyGphone




 
 
Register or Connect with Facebook

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  
Old 10-29-2008, 09: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 05:01 AM..
Digg StumbleUpon Delicious Reddit Newsvine Google Yahoo Thanks Reply With Quote
  #2  
Old 10-31-2008, 09: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  
Old 11-03-2008, 03:07 PM
iPhone? More like MyPhone
 
Join Date: Oct 2007
Posts: 111
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  
Old 11-04-2008, 12:07 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

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



Go to Top
ModMyI

All times are GMT -6. The time now is 05:22 AM. Powered by vBulletin® Version 3.8.4
If you need Dedicated Server Hosting, you should check out SingleHop. | Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.3.0 Copyright © 2007-09 by ModMy, LLC. All rights reserved.

iPhone News / iPhone Forums / Apple News / Apple Forums / RSS / Contact Us / / Privacy Statement / Top