Community
cancel
Showing results for 
Search instead for 
Did you mean: 
amutlu
Beginner
58 Views

unordered_man problem

Hi,
When compiling my code, I got the following error

icc main_toplu.cpp -openmp -I/home1/mutlu/mysql-connector-c++/include -L/home1/mutlu/mysql-connector-c++/lib -lmysqlcppconn -o main_toplu
/usr/include/c++/4.1.2/tr1/hashtable(1041): error: too few template parameters -- does not match previous declaration
template
^
detected during:
instantiation of class "std::tr1::hashtable [with Key=std::string, Value=std::pair, Allocator=std::allocator<:PAIR>>, ExtractKey=Internal::extract1st<:PAIR>>, Equal=std::equal_to<:STRING>, H1=std::tr1::hash<:STRING>, H2=Internal::mod_range_hashing, H=Internal::default_ranged_hash,
RehashPolicy=Internal::prime_rehash_policy, cache_hash_code=false, constant_iterators=false, unique_keys=true]" at line 56 of "/usr/include/c++/4.1.2/tr1/unordered_map"
instantiation of class "std::tr1::unordered_map [with Key=std::string, T=long, Hash=std::tr1::hash<:STRING>, Pred=std::equal_to<:STRING>, Alloc=std::allocator<:PAIR>>, cache_hash_code=false]" at line 38 of "main_toplu.cpp"

compilation aborted for main_toplu.cpp (code 2)

Code segment causing the error is

#include

using std::tr1::unordered_map;

typedef std::tr1::unordered_map umap;
umap sqls_nC, sqls_dC, sqls_nS;
umap specs;

I compile my code like this
icc main_toplu.cppicc -v


icc -v
Version 10.1

gcc -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)


how can I fix this problem, any idea?
0 Kudos
1 Reply
TimP
Black Belt
58 Views

It's safer to use icpc for C++ code, just as you would use g++ rather than gcc.
Assuming that your g++ and gcc versions match, does the example compile with g++ ? You may have a difficult juggling act to find a version of g++ new enough to accept your syntax but old enough to work with your old icpc version.
Reply