LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 03-15-2006, 07:52 AM   #1
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Rep: Reputation: 30
cpp compilation error


hi,
I am trying to compile a C++ program on my RHEL 4 AS and got following errors
Code:
 
[guest@localhost prg]g++ ex.cpp -o ex
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:31,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:44:28: bits/c++config.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:44,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:46:29: bits/c++locale.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:47:25: bits/c++io.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:46,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static typename __gnu_cxx::_Char_types<_CharT>::int_type __gnu_cxx::char_traits<_CharT>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: `EOF' undeclared (first use this function)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: (Each undeclared identifier is reported only once for each function it appears in.)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static int std::char_traits<char>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:291: error: `EOF' undeclared (first use this function)
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:33:30: bits/atomic_word.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected constructor, destructor, or type conversion before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected `,' or `;' before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:43: error: expected `,' or `...' before '*' token
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:52:31: bits/c++allocator.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
                 from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
                 from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected template-name before '<' token

[root@localhost prg]# rpm -qa | grep gcc
libgcc-3.4.4-2
compat-gcc-32-c++-3.2.3-47.3
gcc-java-3.4.4-2
gcc-3.4.4-2
gcc-c++-3.4.4-2
compat-libgcc-296-2.96-132.7.2
compat-gcc-32-3.2.3-47.3
gcc-g77-3.4.4-2

how to solve those errors so that i cam compile a c++ program?
 
Old 03-15-2006, 08:09 AM   #2
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
it looks like you have errors when including some headers..

how about posting some code?
 
Old 03-15-2006, 08:12 AM   #3
irongun324
LQ Newbie
 
Registered: Feb 2006
Location: TN/AL
Distribution: Slackware 10.2
Posts: 8

Rep: Reputation: 0
I think you need to change your program like the first line says,

change this:
#include <iostream.h>

to this:
#include <iostream>

Is what I interpret from the first line of error... looks like that carrys down through the errors.
Novice programmer myself, but maybe that will help, I have only used <iostream> in my short programs.
 
Old 03-15-2006, 08:36 AM   #4
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
post some code.. as using a deprecated header iostream.h will not give you
'error: expected template-name before '<' token'
 
Old 03-15-2006, 09:47 PM   #5
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
hi,
Here is my code
Quote:
#include <iostream.h>
int main()
{
cout <<"HI";
return 0;
}
and using following command to compile a C++ program
Quote:
gcc ex1.c -o ex1
 
Old 03-15-2006, 10:36 PM   #6
spooon
Senior Member
 
Registered: Aug 2005
Posts: 1,755

Rep: Reputation: 51
Quote:
Originally Posted by cranium2004
and using following command to compile a C++ program
Code:
g++ ex1.c -o ex1
Use g++ (not gcc) to compile C++ ! And you should preferably use the ".cpp" extension for C++ code.

Also, some fixes to your code:
Code:
#include <iostream>
using namespace std;

int main()
{
cout <<"HI";
return 0;
}
 
Old 03-15-2006, 11:16 PM   #7
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
hi,
that was my mistake(of writing .c) i did same what you told with my source code as well as your source code like compiling with g++ and using .cpp but sill same errors are there.
Quote:
g++ ex.cpp -o ex
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:31,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:44:28: bits/c++config.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:44,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:46:29: bits/c++locale.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:47:25: bits/c++io.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:46,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static typename __gnu_cxx::_Char_types<_CharT>::int_type __gnu_cxx::char_traits<_CharT>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: `EOF' undeclared (first use this function)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: (Each undeclared identifier is reported only once for each function it appears in.)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static int std::char_traits<char>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:291: error: `EOF' undeclared (first use this function)
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:33:30: bits/atomic_word.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected constructor, destructor, or type conversion before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected `,' or `;' before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:43: error: expected `,' or `...' before '*' token
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:52:31: bits/c++allocator.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected template-name before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected `{' before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected unqualified-id before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected `;' before '<' token
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:53,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:148: error: `_Atomic_word' does not name a type
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:217: error: `__exchange_and_add' is not a member of `__gnu_cxx'
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::size_type std::basic_string<_CharT, _Traits, _Alloc>::_M_check(typename _Alloc::size_type, const char*) const':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:290: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:290: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::const_reference std::basic_string<_CharT, _Traits, _Alloc>::at(typename _Alloc::size_type) const':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:662: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::reference std::basic_string<_CharT, _Traits, _Alloc>::at(typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:681: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::_M_replace_aux(typename _Alloc::size_type, typename _Alloc::size_type, typename _Alloc::size_type, _CharT)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:1359: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:57,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/backward/iostream.h:32,
from ex.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In static member function `static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:145: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*, typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:269: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
[parag@asterix pgq]$ vi ex1.cpp
[parag@asterix pgq]$ g++ ex1.cpp -o ex1
In file included from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:44:28: bits/c++config.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:44,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:46:29: bits/c++locale.h: No such file or directory
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iosfwd:47:25: bits/c++io.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:46,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static typename __gnu_cxx::_Char_types<_CharT>::int_type __gnu_cxx::char_traits<_CharT>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: `EOF' undeclared (first use this function)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:139: error: (Each undeclared identifier is reported only once for each function it appears in.)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h: In static member function `static int std::char_traits<char>::eof()':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/char_traits.h:291: error: `EOF' undeclared (first use this function)
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:33:30: bits/atomic_word.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h: At global scope:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected constructor, destructor, or type conversion before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:39: error: expected `,' or `;' before "__exchange_and_add"
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/atomicity.h:43: error: expected `,' or `...' before '*' token
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:52:31: bits/c++allocator.h: No such file or directory
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/memory:55,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:48,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected template-name before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected `{' before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected unqualified-id before '<' token
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:80: error: expected `;' before '<' token
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:53,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:148: error: `_Atomic_word' does not name a type
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `void std::basic_string<_CharT, _Traits, _Alloc>::_Rep::_M_dispose(const _Alloc&)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:217: error: `__exchange_and_add' is not a member of `__gnu_cxx'
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::size_type std::basic_string<_CharT, _Traits, _Alloc>::_M_check(typename _Alloc::size_type, const char*) const':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:290: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:290: error: (if you use `-fpermissive', G++ will accept your code, but allowing the use of an undeclared name is deprecated)
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::const_reference std::basic_string<_CharT, _Traits, _Alloc>::at(typename _Alloc::size_type) const':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:662: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `typename _Alloc::reference std::basic_string<_CharT, _Traits, _Alloc>::at(typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:681: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::_M_replace_aux(typename _Alloc::size_type, typename _Alloc::size_type, typename _Alloc::size_type, _CharT)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:1359: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
In file included from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/string:57,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/locale_classes.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/ios_base.h:47,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ios:49,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/ostream:45,
from /usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/iostream:45,
from ex1.cpp:1:
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In static member function `static _CharT* std::basic_string<_CharT, _Traits, _Alloc>::_S_construct(_InIterator, _InIterator, const _Alloc&, std::forward_iterator_tag)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:145: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::assign(const _CharT*, typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:269: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::insert(typename _Alloc::size_type, const _CharT*, typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:296: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc: In member function `std::basic_string<_CharT, _Traits, _Alloc>& std::basic_string<_CharT, _Traits, _Alloc>::replace(typename _Alloc::size_type, typename _Alloc::size_type, const _CharT*, typename _Alloc::size_type)':
/usr/lib/gcc/x86_64-redhat-linux/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.tcc:333: error: there are no arguments to `__N' that depend on a template parameter, so a declaration of `__N' must be available

Last edited by cranium2004; 03-15-2006 at 11:18 PM.
 
Old 03-16-2006, 06:12 AM   #8
irongun324
LQ Newbie
 
Registered: Feb 2006
Location: TN/AL
Distribution: Slackware 10.2
Posts: 8

Rep: Reputation: 0
You're still using iostream.h it looks like. change that to iostream (remove the .h on the end)

If you copy and paste the code that spooon put there your example program should compile correctly.
 
Old 03-16-2006, 07:39 AM   #9
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
why did you have
Code:
[guest@localhost prg]g++ ex.cpp -o ex
in the original message if that is not what you were doing?

edit> and as irongun said, you need
#include <iostream>
using namespace std;

Last edited by xhi; 03-16-2006 at 07:41 AM.
 
  


Reply



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
cpp error ashirazi Programming 1 09-18-2004 05:49 PM
Chitin.cpp error abk4523 Linux - Games 0 09-12-2004 10:17 AM
debian dpkg cpp depends on cpp error darkleaf Linux - Software 2 06-25-2004 01:47 AM
CPP error, please help... TomAL Mandriva 3 12-24-2003 09:57 AM
cpp error ANU Linux - Software 1 12-05-2003 11:24 PM

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

All times are GMT -5. The time now is 03:18 PM.

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