Pedro Lamarão wrote:
On 7 nov, 01:40, Jim Anderson <[EMAIL PROTECTED]> wrote:
I'd like to use the hash_map template from the stlport which I
picked up at sourceforge.net (version 5.1.4). I installed the
library and then create the example given
athttp://www.sgi.com/tech/stl/hash_map.html. I've attached
this example (sample.cc) and a simple makefile. The only change I've
made to the example is to add the #include statements
for iostream and hash_map.
---------------
When I compile, I get the following output:
g++ -I/home/jja/work/prog/dev/ind/include/stlport -o sample sample.cc
sample.cc: In function 'int main()':
sample.cc:15: error: 'hash_map' was not declared in this scope
sample.cc:15: error: expected primary-expression before 'const'
sample.cc:15: error: expected `;' before 'const'
sample.cc:17: error: 'months' was not declared in this scope
sample.cc:30: error: 'cout' was not declared in this scope
sample.cc:30: error: 'endl' was not declared in this scope
make: *** [sample] Error 1
----------------
I ran the sample program through cpp to verify that hash_map
is being read in. It appears to be read in, yet I'm getting
the error that 'hash_map' was not declared. I'm guessing
the error message is telling me that the template is not
instansiating the hash_map class that is needed, but I'm
not sure. Can anyone explain the error message and why
the SGI example will not compile?
The missing names are all in namespace std.
You are missing the proper using declarations.
--
Pedro Lamarão
Pedro,
Thank you for you suggestion. I have added a 'using namespace std'
to my source file, sample.cc. When I try to compile, I now get
link errors which can be seen in the attached file, 'out'.
Can you look at my source file and makefile and give an opinion
on whether the file should compile and link cleanly?
I appreciate if you can take the additional time to help.
Regards,
Jim Anderson
_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus