Problem w/ simple Hello World compiled w/ g++
Keyser
keyser456 at verizon.net
Tue Jun 7 19:01:03 GMT 2005
I know quite a bit about programming, but not a lot about FreeBSD. I've been pulling my hair out all morning just trying to get an unbelievably simple c++ "Hello World" program to run (it compiles fine) under FreeBSD. Here's the source:
//helloworld.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
return 0;
}
I use g++ and it compiles fine, but I get an error immediately after running the program:
# g++ -v
Using built-in specs.
Configured with: FreeBSD/i386 system compiler
Thread model: posix
gcc version 3.4.2 [FreeBSD] 20040728
# ls
helloworld.cpp
# g++ -o helloworld helloworld.cpp
# ls
helloworld helloworld.cpp
# ./helloworld
Segmentation fault (core dumped)
Do I have missing or out of date libraries (not sure how that's possible since I'm using the latest version of FreeBSD, 5.4) or something and how do I remedy that situation? Also, I haven't "added" anything else related to development yet, and wouldn't expect I'd have to just to get a Hello World program to run properly, but maybe I'm wrong?
More information about the freebsd-questions
mailing list