|
From: <qa...@ho...> - 2003-04-06 14:46:53
|
Hi. I need to use hash_map but I can't get it to compile. The code below is a subset of the example code found att the SGI=B4s STL= documentation (http://www.sgi.com/tech/stl/hash_map.html) //--- Code start --- #include <iostream> #include <hash_map> using namespace std; struct eqstr { bool operator()(const char* s1, const char* s2) const { return strcmp(s1, s2) =3D=3D 0; } }; int main() { hash_map<const char*, int, hash<const char*>, eqstr> months; months["september"] =3D 30; cout << "september -> " << months["september"] << endl; system("PAUSE"); } //--- Code end --- and the compile log... //--- Start log --- make.exe -f "D:\Programmering\IDE\Dev-Cpp\tmp\Makefile.win" all g++.exe -c main.cpp -o main.o -I"D:/Programmering/IDE/Dev-Cpp/include/c++"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/mingw32"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/backward"= -I"D:/Programmering/IDE/Dev-Cpp/include"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/ext" main.cpp: In function `int main()': main.cpp:16: `hash_map' undeclared (first use this function) main.cpp:16: (Each undeclared identifier is reported only once for each function it appears in.) main.cpp:16: parse error before `char' main.cpp:18: `months' undeclared (first use this function) make.exe: *** [main.o] Error 1 //--- End log --- The automated make file looks like this // --- End makefile --- # Project: hash_map_test # Makefile created by Dev-C++ 4.9.8.0 CPP =3D g++.exe CC =3D gcc.exe WINDRES =3D windres.exe RES =3D OBJ =3D main.o $(RES) LINKOBJ =3D main.o $(RES) LIBS =3D -L"D:/Programmering/IDE/Dev-Cpp/lib" INCS =3D -I"D:/Programmering/IDE/Dev-Cpp/include" CXXINCS =3D -I"D:/Programmering/IDE/Dev-Cpp/include/c++"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/mingw32"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/backward"= -I"D:/Programmering/IDE/Dev-Cpp/include"= -I"D:/Programmering/IDE/Dev-Cpp/include/c++/ext" BIN =3D hash_map_test.exe CXXFLAGS =3D $(CXXINCS) CFLAGS =3D $(INCS) .PHONY: all all-before all-after clean clean-custom all: all-before hash_map_test.exe all-after clean: clean-custom rm -f $(OBJ) $(BIN) $(BIN): $(LINKOBJ) $(CPP) $(LINKOBJ) -o "hash_map_test.exe" $(LIBS) main.o: main.cpp $(CPP) -c main.cpp -o main.o $(CXXFLAGS) // --- End makefile --- Any ideas??? TIA /J=F6rgen |