C++/make compiler error help

chomsky

Limp Gawd
Joined
Aug 18, 2004
Messages
251
I'm trying to compile a project that was sent to me using the included make file, but I'm getting a bunch of errors. The make file specifies g++-3.3 explicitly, but I commented that out to just use g++ and I'm using -4.0.1, I'm not sure if that's the cause of these problems but I'll mention that straight out. I assume only the first few errors complaining about the templates is probably all you need to diagnose this, but here's a full attempt to compile:

Code:
g++ -MMD -O3 -Wall -ffast-math -fstrict-aliasing -DNDEBUG    -c -o gibbs.o gibbs.cc
In file included from /usr/include/c++/4.0.0/backward/strstream:51,
                 from gibbs.cc:7:
/usr/include/c++/4.0.0/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 
f the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
utility.h:337: error: 'hash' is not a template
utility.h:338: error: explicit specialization of non-template 'std::hash'
utility.h:347: error: 'hash' is not a template
utility.h:347: error: 'std::hash' is not a template type
utility.h:347: error: redefinition of 'struct std::hash'
utility.h:338: error: previous definition of 'struct std::hash'
utility.h:371: error: 'hash' is not a template
utility.h:371: error: 'std::hash' is not a template type
utility.h:371: error: redefinition of 'struct std::hash'
utility.h:338: error: previous definition of 'struct std::hash'
utility.h:383: error: 'hash' is not a template
utility.h:383: error: 'std::hash' is not a template type
utility.h:383: error: redefinition of 'struct std::hash'
utility.h:338: error: previous definition of 'struct std::hash'
utility.h:406: error: 'hash' is not a template
utility.h:406: error: 'slist' is not a member of 'ext'
utility.h:406: error: 'slist' is not a member of 'ext'
utility.h:406: error: 'std::hash' is not a template type
utility.h:406: error: expected unqualified-id before '>' token
utility.h:429: error: 'hash' is not a template
utility.h:429: error: 'std::hash' is not a template type
utility.h:429: error: redefinition of 'struct std::hash'
utility.h:338: error: previous definition of 'struct std::hash'
utility.h:621: error: expected unqualified-id before '<' token
utility.h:621: error: expected ',' or '...' before '<' token
utility.h:621: error: ISO C++ forbids declaration of 'parameter' with no type
utility.h: In function 'std::ostream& operator<<(std::ostream&, int)':
utility.h:624: error: 'slist' in namespace 'ext' does not name a type
utility.h:624: error: expected unqualified-id before '<' token
utility.h:624: error: 'xi' was not declared in this scope
utility.h:624: error: 'xs' was not declared in this scope
utility.h: At global scope:
utility.h:633: error: 'ext::slist' has not been declared
utility.h:633: error: expected ',' or '...' before '<' token
utility.h: In function 'std::istream& operator>>(std::istream&, int)':
utility.h:638: error: 'xs' was not declared in this scope
utility.h:642: error: 'slist' in namespace 'ext' does not name a type
utility.h:642: error: expected unqualified-id before '<' token
utility.h:644: error: 'xi' was not declared in this scope
utility.h: At global scope:
utility.h:706: error: expected unqualified-id before '<' token
utility.h:706: error: expected ',' or '...' before '<' token
utility.h:706: error: ISO C++ forbids declaration of 'parameter' with no type
utility.h:706: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, int)'
utility.h:621: error: 'template<class T> std::ostream& operator<<(std::ostream&, int)' previously declared here
utility.h: In function 'std::ostream& operator<<(std::ostream&, int)':
utility.h:709: error: 'hash_set' in namespace 'ext' does not name a type
utility.h:709: error: expected unqualified-id before '<' token
utility.h:709: error: 'i' was not declared in this scope
utility.h:709: error: 's' was not declared in this scope
utility.h: At global scope:
utility.h:718: error: 'ext::hash_set' has not been declared
utility.h:718: error: expected ',' or '...' before '<' token
utility.h:718: error: redefinition of 'template<class T> std::istream& operator>>(std::istream&, int)'
utility.h:633: error: 'template<class T> std::istream& operator>>(std::istream&, int)' previously declared here
utility.h: In function 'std::istream& operator>>(std::istream&, int)':
utility.h:723: error: 's' was not declared in this scope
utility.h: At global scope:
utility.h:782: error: expected unqualified-id before '<' token
utility.h:782: error: expected ',' or '...' before '<' token
utility.h:782: error: ISO C++ forbids declaration of 'parameter' with no type
utility.h: In function 'std::ostream& operator<<(std::ostream&, int)':
utility.h:784: error: expected initializer before '<' token
utility.h:786: error: 'M' has not been declared
utility.h:786: error: expected initializer before 'it'
utility.h:786: error: 'it' was not declared in this scope
utility.h:786: error: 'm' was not declared in this scope
utility.h: At global scope:
utility.h:795: error: 'ext::hash_map' has not been declared
utility.h:795: error: expected ',' or '...' before '<' token
utility.h: In function 'std::istream& operator>>(std::istream&, int)':
utility.h:800: error: 'm' was not declared in this scope
utility.h: In function 'std::ostream& operator<<(std::ostream&, resource_usage)':
utility.h:869: warning: unused variable 'result'
stringid.h: At global scope:
stringid.h:18: error: ISO C++ forbids declaration of 'hash_map' with no type
stringid.h:18: error: typedef name may not be a nested-name-specifier
stringid.h:18: error: expected ';' before '<' token
stringid.h:21: error: 'S_C' does not name a type
stringid.h: In member function 'size_t stringid::size() const':
stringid.h:27: error: 'string_id' was not declared in this scope
stringid.h: In member function 'size_t stringid::operator()(const std::string&)':
stringid.h:31: error: 'S_C' has not been declared
stringid.h:31: error: 'iterator' was not declared in this scope
stringid.h:31: error: template argument 1 is invalid
stringid.h:31: error: invalid type in declaration before '=' token
stringid.h:31: error: 'string_id' was not declared in this scope
stringid.h:32: error: request for member 'second' in 'i', which is of non-class type 'int'
stringid.h:33: error: request for member 'first' in 'i', which is of non-class type 'int'
stringid.h:36: error: request for member 'first' in 'i', which is of non-class type 'int'
typedefs.h: At global scope:
typedefs.h:20: error: expected initializer before '<' token
typedefs.h:23: error: expected initializer before '<' token
typedefs.h:24: error: expected initializer before '<' token
SGLexicon.h:23: error: expected template-name before '<' token
SGLexicon.h:23: error: expected `{' before '<' token
SGLexicon.h:23: error: expected unqualified-id before '<' token
Smooth.h: In member function 'virtual void MonkeySmooth::init(const stringid*, const stringid*, const Lexicon&, Float, Float)':
Smooth.h:82: error: invalid use of undefined type 'const class SGLexicon<std::string, Count>'
SGLexicon.h:23: error: declaration of 'const class SGLexicon<std::string, Count>'
Smooth.h: In constructor 'BigramSmooth::BigramSmooth(const stringid*, const stringid*, const Lexicon&, Float, Float)':
Smooth.h:108: error: invalid use of undefined type 'const class SGLexicon<std::string, Count>'
SGLexicon.h:23: error: declaration of 'const class SGLexicon<std::string, Count>'
Smooth.h:145: confused by earlier errors, bailing out
make: *** [gibbs.o] Error 1

Well, googling some of these errors only comes up with other people complaining but no responses, so I'd appreciate any help on the issue. This is done on a mac btw.
 
The error messages mean something is wrong with the code. Maybe your configuration is the problem, maybe the build isn't right, maybe the source files are corrupted, maybe the code didn't work to begin with.

One of the reasons you don't see many responses is that it takes a lot of expertise and background information to diagnose and repair source code.
 
I know that this code compiled with make on a different machine, was tarballed, sent to me, and now it throws all these errors. So I'm really asking, do these errors look indicative of some problem in my environment that you recognize?
 
Get the .cshrc/.profile file from the other machine and see if there is an environment variable path that is needed.
 
Code:
/usr/include/c++/4.0.0/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 
f the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
Would indicate that the code relies on old functions and libraries that were deprecated (or, more likely, removed) in gcc4. I'd install an older version.
 
Yep, Arainach got it. Works fine with g++-3.3. I thought those warnings were just advisory for deprecated items, not full-out incompatibilty. Oh well. Thanks!
 
That's curious, as iostream.h doesn't define a type named "hash".

I'm glad youv'e got it working, tho.
 
Back
Top