LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-14-2009, 12:20 PM   #1
iqbala
Member
 
Registered: Dec 2003
Location: Milano (ITALY)
Distribution: Kubuntu 20.04
Posts: 285

Rep: Reputation: 32
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?
 
Old 10-14-2009, 03:28 PM   #2
iqbala
Member
 
Registered: Dec 2003
Location: Milano (ITALY)
Distribution: Kubuntu 20.04
Posts: 285

Original Poster
Rep: Reputation: 32
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)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
what package is iostream.h in? bio71 Programming 3 09-11-2008 10:11 PM
Linux iostream vs Windows iostream davidguygc Programming 2 05-13-2007 09:13 PM
LXer: Sun Announces the Latest in Open Source Tools with the Availability of NetBeans Visual Web Pack and NetBeans C/C++ Development Pack LXer Syndicated Linux News 1 12-31-2006 07:37 AM
where is iostream invisibleghost Programming 2 10-24-2004 01:30 PM
g++ why cant i #include \<iostream\> ??? qwijibow Programming 4 10-03-2003 07:17 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration