- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When compiling a class in a linux machine, I got theerror message " error: expected a ";" ". The class is compiled fine using VS 2005 in Windows. The following isthe simplified version of the class. The error is from the first line of the Find() function. I cann't findwhy I get this error. The compiler version is 9.1.043
template
{
public:
MyClass() {};
~MyClass(void) {};
T* Find(int nKey) {
map
return it == m_map.end() ? NULL : it->second;
};
map
};
-----------------------------------------------------------
error: expected a ";"
map
^
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
do you have your own "map" template? I tried it, it works for me on IA32.
$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 9.1 Build 20060816Z Package ID: l_cc_c_9.1.043
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
$ cat t.cpp
#include
$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 9.1 Build 20060816Z Package ID: l_cc_c_9.1.043
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
$ cat t.cpp
#include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Jennifer Jiang (Intel)
do you have your own "map" template? I tried it, it works for me on IA32.
$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 9.1 Build 20060816Z Package ID: l_cc_c_9.1.043
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
$ cat t.cpp
#include
$ icpc -V
Intel C++ Compiler for 32-bit applications, Version 9.1 Build 20060816Z Package ID: l_cc_c_9.1.043
Copyright (C) 1985-2006 Intel Corporation. All rights reserved.
$ cat t.cpp
#include
Thank you for your quick reply. I finally find what is missing. For template argument dependent name, the 'typename' keyword is neededin front of it. Now it becomes:
typename map
And it works fine now.
Thanks again for your help.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page