Click to See Complete Forum and Search --> : C++ in BeOS


TaeShadow
12-04-2000, 06:43 PM
Has anyone here programmed in C++ in BeOS? I can't get it to work right. I installed all of the development tools following the readme exactly. I type the following program:


#include <iostream.h>

int main()
{
cout << "hello world!\n";
return 0;
}


I then compile it with g++. It gives no errors. I run it, and nothing happens. It takes me right back to the prompt. It doesn't print "hello world" or anything. Any clues?

Beowulf_Ghost
12-05-2000, 10:49 AM
Are you using just gcc in the shell, or are you using the Metrowerks IDE (BeDevTools). I made the same hello world app just now, in BeIDE, made it and ran it with no problems.
http://www.neo-programmers.com/ has some information for programmers new to BeOS. But you have to be careful, because some of the stuff was writen for BeOS R4, and some for R5. http://www.thegreenboard.com has forums for programers, both new and advanced.

------------------
Silence is Foo!
------------------
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." - Ben Franklin, ~1784

http://www.lp.org

TaeShadow
12-05-2000, 01:36 PM
Yes, I tried it in BeIDE, and it works perfectly now. I did some research on the issue, though, and discovered why it didn't print anything at the terminal. The reason is that BeOS will not print anything until it recieves an end-of-line (endl). The code should look like this:


#include <iostream.h>
int main()
{
cout << "hello world!" << endl;
return 0;
}


But, it's probably just better to use the IDE.