By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,844 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

problems switching to gcc 3.3.2

P: n/a
Hi,

compiling my source files with gcc 2.95.3 works fine.
When I switch to gcc 3.3.2 and try to compile the same
files I get some error messages.

My header file hash.h begins with:

#include <map>
#include <string>
[snip]
class HashTable
{
map<int, void*> nhash; //line 49
map<string, void*> shash; //line 50
[snip]

Trying to compile I get:
In file included from hash.cpp:8:
hash.h:49: error: 'map' is used as a type, but is not defined as a type.
hash.h:50: error: `string' was not declared in this scope
hash.h:50: error: 'map' is used as a type, but is not defined as a type.
Any ideas how to solve that problem.

Chris
Jul 23 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Christian Christmann wrote:
compiling my source files with gcc 2.95.3 works fine.
When I switch to gcc 3.3.2 and try to compile the same
files I get some error messages.

My header file hash.h begins with:

#include <map>
#include <string>
[snip]
class HashTable
{
map<int, void*> nhash; //line 49
map<string, void*> shash; //line 50
[snip]

Trying to compile I get:
In file included from hash.cpp:8:
hash.h:49: error: 'map' is used as a type, but is not defined as a type.
hash.h:50: error: `string' was not declared in this scope
hash.h:50: error: 'map' is used as a type, but is not defined as a type.
Any ideas how to solve that problem.


Have you tried

std::map<int,void*> nhash;
std::map<std::string,void*> shash;

or at least

using std::map;
using std::string;

or if all else fails

using namespace std;

?

V
Jul 23 '05 #2

P: n/a
#include <map>
#include <string>
[snip]
class HashTable
{
map<int, void*> nhash; //line 49
map<string, void*> shash; //line 50
[snip]

Trying to compile I get:
In file included from hash.cpp:8:
hash.h:49: error: 'map' is used as a type, but is not defined as a type.
hash.h:50: error: `string' was not declared in this scope hash.h:50:
error: 'map' is used as a type, but is not defined as a type.
Have you tried

std::map<int,void*> nhash;
std::map<std::string,void*> shash;


Thanks, it works
V


Chris

Jul 23 '05 #3

P: n/a
Christian Christmann wrote:
#include <map>
#include <string>
[snip]
class HashTable
{
map<int, void*> nhash; //line 49
map<string, void*> shash; //line 50
[snip]

Trying to compile I get:
In file included from hash.cpp:8:
hash.h:49: error: 'map' is used as a type, but is not defined as a type.
hash.h:50: error: `string' was not declared in this scope
hash.h:50: error: 'map' is used as a type, but is not defined as a type.
Any ideas how to solve that problem.

using namespace std;

--
Ioannis Vranos

http://www23.brinkster.com/noicys
Jul 23 '05 #4

P: n/a

"Ioannis Vranos" <iv*@remove.this.grad.com> wrote in message
news:1112375428.122878@athnrd02...
Christian Christmann wrote:
#include <map>
#include <string>
[snip]
class HashTable
{
map<int, void*> nhash; //line 49
map<string, void*> shash; //line 50
[snip]

Trying to compile I get:
In file included from hash.cpp:8:
hash.h:49: error: 'map' is used as a type, but is not defined as a type.
hash.h:50: error: `string' was not declared in this scope
hash.h:50: error: 'map' is used as a type, but is not defined as a type.
Any ideas how to solve that problem.

using namespace std;


Not a good idea, since this is in a header file. Better to juse qualify the
map and string types with std::.

-Howard


Jul 23 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.