LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   errors using iostream with C++ netbeans (https://www.linuxquestions.org/questions/programming-9/errors-using-iostream-with-c-netbeans-761880/)

iqbala 10-14-2009 12:20 PM

errors using iostream with C++ netbeans
 
I am just now trying to begin to learn C++.

I installed Netbeans and tried the simple "hello world" example

#include <iostream>
using namespace std;

int main ()
{
cout << "Hello World!";
return 0;
}

At first I did not find the iostream library, but now that I have i get the error

"expected _ or "" before std"

What does it mean? Do I have got an incorrect version of iostream?

iqbala 10-14-2009 03:28 PM

I found that I had more than one iostream.

Now I get this kind of messages

Running "/usr/bin/make -f Makefile CONF=Debug" in /home/andreaeddye/NetBeansProjects/Application-prova1

/usr/bin/make -f nbproject/Makefile-Debug.mk SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/andreaeddye/NetBeansProjects/Application-prova1'
/usr/bin/make -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/application-prova1
make[2]: Entering directory `/home/andreaeddye/NetBeansProjects/Application-prova1'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/newmain.o.d
gcc -c -g -MMD -MP -MF build/Debug/GNU-Linux-x86/newmain.o.d -o build/Debug/GNU-Linux-x86/newmain.o newmain.c
/usr/include/c++/4.3.3/iostream: In function ‘_GLIBCXX_BEGIN_NAMESPACE’:
In file included from newmain.c:10:
/usr/include/c++/4.3.3/iostream:63: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cin’
/usr/include/c++/4.3.3/iostream:64: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cout’
/usr/include/c++/4.3.3/iostream:65: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘cerr’
/usr/include/c++/4.3.3/iostream:66: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘clog’
/usr/include/c++/4.3.3/iostream:77: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘:’ token
/usr/include/c++/4.3.3/iostream:79: error: expected declaration specifiers before ‘_GLIBCXX_END_NAMESPACE’
newmain.c:16: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
newmain.c:21: error: expected ‘{’ at end of input
make[2]: *** [build/Debug/GNU-Linux-x86/newmain.o] Error 1
make[2]: Leaving directory `/home/andreaeddye/NetBeansProjects/Application-prova1'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/andreaeddye/NetBeansProjects/Application-prova1'
make: *** [.build-impl] Error 2

Build failed. Exit value 2.



The errors are signalled in code lines internal to the iostream file:

extern istream cin; ///< Linked to standard input
extern ostream cout; ///< Linked to standard output
extern ostream cerr; ///< Linked to standard error (unbuffered)
extern ostream clog; ///< Linked to standard error (buffered)


All times are GMT -5. The time now is 06:48 PM.