G
Guest
First time for everything..
Installed Cbuilder from Borland, and try to build the helloworld program
(below) that pops up when I start cbuilder. When building, I get this:
g++ -c -o /usr/local/CBuilderX/samples/welcome/linux/Release_Build/main.o
-MD -I/usr/include -I/usr/include/g++-3 HelloWorld/main.cpp
HelloWorld/main.cpp: In function `int main(int, char**)':
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 6
"main.cpp": HelloWorld/main.cpp error: `endl' undeclared in namespace
`std' at line 6
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 7
"main.cpp": HelloWorld/main.cpp error: `cin' undeclared in namespace `std'
at line 9
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 11
"main.cpp": HelloWorld/main.cpp error: `endl' undeclared in namespace
`std' at line 11
GNU C++ Compiler exited with error code: 1
Build cancelled due to errors
However, if I remove the "-I/usr/include/g++-3" option, it builds and runs
ok. The compile options are default in cbuilder. The g++-3 directory is
present, and readable. Could someone please shed some light on this?
[main.c]
#include <iostream>
#include "main.h"
int main(int /*argc*/, char* /*argv*/[])
{
std::cout << "Hello world!" << std::endl;
std::cout << "Please enter a character and press return:";
std::cin.get();
std::cout << "Goodbye world!" << std::endl;
return 0;
}
[/main.c]
[main.h]
#if !defined(__main_h)
#define __main_h
#endif
[/main.h]
Installed Cbuilder from Borland, and try to build the helloworld program
(below) that pops up when I start cbuilder. When building, I get this:
g++ -c -o /usr/local/CBuilderX/samples/welcome/linux/Release_Build/main.o
-MD -I/usr/include -I/usr/include/g++-3 HelloWorld/main.cpp
HelloWorld/main.cpp: In function `int main(int, char**)':
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 6
"main.cpp": HelloWorld/main.cpp error: `endl' undeclared in namespace
`std' at line 6
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 7
"main.cpp": HelloWorld/main.cpp error: `cin' undeclared in namespace `std'
at line 9
"main.cpp": HelloWorld/main.cpp error: `cout' undeclared in namespace
`std' at line 11
"main.cpp": HelloWorld/main.cpp error: `endl' undeclared in namespace
`std' at line 11
GNU C++ Compiler exited with error code: 1
Build cancelled due to errors
However, if I remove the "-I/usr/include/g++-3" option, it builds and runs
ok. The compile options are default in cbuilder. The g++-3 directory is
present, and readable. Could someone please shed some light on this?
[main.c]
#include <iostream>
#include "main.h"
int main(int /*argc*/, char* /*argv*/[])
{
std::cout << "Hello world!" << std::endl;
std::cout << "Please enter a character and press return:";
std::cin.get();
std::cout << "Goodbye world!" << std::endl;
return 0;
}
[/main.c]
[main.h]
#if !defined(__main_h)
#define __main_h
#endif
[/main.h]