maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N900 (https://talk.maemo.org/forumdisplay.php?f=44)
-   -   [solved](.cpp)"Hello world" in n900 (getting error) plz guide me. (https://talk.maemo.org/showthread.php?t=74021)

nicholes 2011-06-15 16:20

[solved](.cpp)"Hello world" in n900 (getting error) plz guide me.
 
1 Attachment(s)
Here i have done a few things on my N900 from

http://ossguy.com/?p=475

to run .cpp files

and when i try to run this using g++ it shows error

here is my programme

# include <stdio.h>
# include <conio.h>
int main (void)
{
printf ("hlloe wolrd");
getch();

}

UPDATE: Thanks to all of you guys i managed to run and also modify .cpp files now (i am using filebox along with the leafpad to edit .cpp)

Captwheeto 2011-06-15 16:27

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
I've never touched C++ but I have done a little C.
Is there any reason why you're using them headers?
You should only need stdio, like so


#include <stdio.h>

int main(void)
{
printf("hello, world\n");
return 0;
}

unless you were planning to expand. Were you trying to get stdin from the user? I'm Perl/Haskell guy. Sorry I can't be of more help

attila77 2011-06-15 16:30

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by nicholes (Post 1029733)
Here i have done a few things on my N900 from

http://ossguy.com/?p=475

to run .cpp files

and when i try to run this using g++ it shows error

here is my programme

# include <stdio.h>
# include <conio.h>
int main (void)
{
printf ("hlloe wolrd");
getch();

}

Any particular reason for not using the QtSDK but go for on-device compile ?

nicholes 2011-06-15 16:36

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by Captwheeto (Post 1029737)
I've never touched C++ but I have done a little C.
Is there any reason why you're using them headers?
You should only need stdio, like so


#include <stdio.h>

int main(void)
{
printf("hello, world\n");
return 0;
}

unless you were planning to expand. Were you trying to get stdin from the user? I'm Perl/Haskell guy. Sorry I can't be of more help

i use your methode (using my pc dev c++) but it does nothig a cmd flashes and gone nothing happand

also i am using <conio.h> header file to use getch() for "heelo wolrd" to remain on the screen

nicholes 2011-06-15 16:39

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by attila77 (Post 1029738)
Any particular reason for not using the QtSDK but go for on-device compile ?

i am learning in my institute and there is no qtsdk but a very older (turboc++ installed in a pc)

i wont to show them all THE POWER OF N900!

SubCore 2011-06-15 16:50

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
you need to tell g++ where to look for conio.h, usually via the -L switch.

but google tells me that conio.h is a very old msdos library, i doubt it'll work in this environment. try something like "cin.get()" (and #include <iostream>)

StefanL 2011-06-15 16:55

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by nicholes (Post 1029733)
Here i have done a few things on my N900 from

http://ossguy.com/?p=475

to run .cpp files

and when i try to run this using g++ it shows error

here is my programme

# include <stdio.h>
# include <conio.h>
int main (void)
{
printf ("hlloe wolrd");
getch();

}

Your problem is using a non-standard header file and function (google getch():rolleyes:), this was invented for DOS and only supported by certain compilers. Try using one of the standard input functions and get rid of conio.h if you want to compile it on the N900. ;)

nicholes 2011-06-15 16:56

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by SubCore (Post 1029753)
you need to tell g++ where to look for conio.h, usually via the -L switch.

but google tells me that conio.h is a very old msdos library, i doubt it'll work in this environment. try something like "cin.get()" (and #include <iostream>)

i know but my my programme don't work without conio.h (a cmd flashes only)any other method to do this (i am new in coding)

nicholes 2011-06-15 16:58

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by StefanL (Post 1029754)
Your problem is using a non-standard header file and function (google getch():rolleyes:), this was invented for DOS and only supported by certain compilers. Try using one of the standard input functions and get rid of conio.h if you want to compile it on the N900. ;)

can you give an example here for me how to get rid of conio.h and getch():)?

StefanL 2011-06-15 17:01

Re: (.cpp)"Hello world" in n900 (getting error) plz guide me.
 
Quote:

Originally Posted by nicholes (Post 1029756)
can you give an example here for me how to get rid of conio.h and getch():)?

Dude, I am not a C programmer, but using googles for getch pops a number of websites with the answer. Sorry can't help you any more (is like the horse and the water thingy;)).


All times are GMT. The time now is 21:47.

vBulletin® Version 3.8.8