- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Accidentally posted this in the HPC foum so here it is, in the right place!
Hello,
I'm trying to compile octave, which has some code similar to the test file below:
test.cc:
class A {};
template void method (double u, T v);
template void method (double u, long v);
int main (){
double u(0); long v(0);
method (u, v);
}
If I compile with icpc -c test.cc I get:
[root@localhost ~]# icpc -v
Version 11.1
[root@localhost ~]# icpc -c test.cc
test.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
function template "void method(double, T)"
function template "void method(double, long)"
argument types are: (double, long)
me... (u, v);
^
compilation aborted for test.cc (code 2)
The same code compiles fine with gcc version 4.1.2. I'm running on CentOS 4.8, 32-bit. Is this a bug in the compiler? Thanks,
Russell
Hello,
I'm trying to compile octave, which has some code similar to the test file below:
test.cc:
class A {};
template
template
int main (){
double u(0); long v(0);
method (u, v);
}
If I compile with icpc -c test.cc I get:
[root@localhost ~]# icpc -v
Version 11.1
[root@localhost ~]# icpc -c test.cc
test.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
function template "void method
function template "void method
argument types are: (double, long)
me...
^
compilation aborted for test.cc (code 2)
The same code compiles fine with gcc version 4.1.2. I'm running on CentOS 4.8, 32-bit. Is this a bug in the compiler? Thanks,
Russell
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code compiles with gcc4.1 and later but not withearlier versions of gcc.
In order to be compatible to with all versions of gcc the Intel compiler implicit looks at what "gcc" version is in your PATH and set the -gcc-version switch appropriately. If you are using a binary called"gcc4" as your gcc compiler then icc doesn't know that you really want compatibility with "gcc4" - it thinks you want compatibility with "gcc".
Two solutions:
(1) Put an alias or linkof gcc to gcc4 in your PATH
(2) Explicitly use the -gcc-version=410 switch
Judy
In order to be compatible to with all versions of gcc the Intel compiler implicit looks at what "gcc" version is in your PATH and set the -gcc-version switch appropriately. If you are using a binary called"gcc4" as your gcc compiler then icc doesn't know that you really want compatibility with "gcc4" - it thinks you want compatibility with "gcc".
Two solutions:
(1) Put an alias or linkof gcc to gcc4 in your PATH
(2) Explicitly use the -gcc-version=410 switch
Judy
Link Copied
10 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Russell,
I tested icc 11.1.064 and 11.1.072. Both of them compile test.cc without any problem on 32-bit OS. Could you please let me know the package ID of your icc? Type icc -V to see package ID.
$ icc -V
Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: l_cproc_p_11.1.064
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
BTW, my gcc is 4.1.0 and 4.1.1.
I tested icc 11.1.064 and 11.1.072. Both of them compile test.cc without any problem on 32-bit OS. Could you please let me know the package ID of your icc? Type icc -V to see package ID.
$ icc -V
Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20091130 Package ID: l_cproc_p_11.1.064
Copyright (C) 1985-2009 Intel Corporation. All rights reserved.
BTW, my gcc is 4.1.0 and 4.1.1.
Thank you. -- Feilong H. Intel Developer Support Tools Knowledge Base: http://software.intel.com/en-us/articles/tools |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Plese see the following screen output. I really can't imagine what would make the compiler behave differently on your machine vs. mine, any ideas? Is this a bug that was fixed in a specific version of the compiler? And if I can't resolve this, is there a way to work around the bug? Thanks for your time.
[root@localhost ~]# icc -V
Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20100414 Package ID: l_cproc_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
30 DAY EVALUATION LICENSE
icc: NOTE: The evaluation period for this product ends on 17-sep-2010 UTC.
[root@localhost ~]# icc -c test.cc
test.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
function template "void method(double, T)"
function template "void method(double, long)"
argument types are: (double, long)
method (u, v);
^
compilation aborted for test.cc (code 2)
[root@localhost ~]# gcc4 -v
Using built-in specs.
Target: i386-redhat-linux5E
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-excep...
[root@localhost ~]# icc -V
Intel C Compiler Professional for applications running on IA-32, Version 11.1 Build 20100414 Package ID: l_cproc_p_11.1.072
Copyright (C) 1985-2010 Intel Corporation. All rights reserved.
30 DAY EVALUATION LICENSE
icc: NOTE: The evaluation period for this product ends on 17-sep-2010 UTC.
[root@localhost ~]# icc -c test.cc
test.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
function template "void method
function template "void method
argument types are: (double, long)
method (u, v);
^
compilation aborted for test.cc (code 2)
[root@localhost ~]# gcc4 -v
Using built-in specs.
Target: i386-redhat-linux5E
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-excep...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This code builds with gcc 4.1+, so I am going to just recommend that my site stick with gcc for out octave installations. Thanks for the tips.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The code compiles with gcc4.1 and later but not withearlier versions of gcc.
In order to be compatible to with all versions of gcc the Intel compiler implicit looks at what "gcc" version is in your PATH and set the -gcc-version switch appropriately. If you are using a binary called"gcc4" as your gcc compiler then icc doesn't know that you really want compatibility with "gcc4" - it thinks you want compatibility with "gcc".
Two solutions:
(1) Put an alias or linkof gcc to gcc4 in your PATH
(2) Explicitly use the -gcc-version=410 switch
Judy
In order to be compatible to with all versions of gcc the Intel compiler implicit looks at what "gcc" version is in your PATH and set the -gcc-version switch appropriately. If you are using a binary called"gcc4" as your gcc compiler then icc doesn't know that you really want compatibility with "gcc4" - it thinks you want compatibility with "gcc".
Two solutions:
(1) Put an alias or linkof gcc to gcc4 in your PATH
(2) Explicitly use the -gcc-version=410 switch
Judy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can compiler the test caseusing icc forIntel64.
I am using gcc 4.4.0 development environment.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Right on! the -gcc-version switch allows me to compile that test code! I'm glad I checked back here, I had all but given up on using the intel compiler. Many thanks! Hopefully this will help someone with the same issue in the future...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It would be realy great if the error messages could include responses from FAQ
Jim Dempseytest.cc(9): error: more than one instance of overloaded function "method" matches the argument list:
function template "void method
(double, T)" function template "void method
(double, long)" argument types are: (double, long)
method (u, v);
^
Did you forget -gcc-version option?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That's an interesting suggestion, but I think in 99% of the cases that is not the real problemwith this kind of overloading error and using the -gcc-version option won't help. In general most users are using "gcc" as their Gnu compiler and therefore shouldn't even need to know about the -gcc-version option. In fact using it could actually be harmful if the system header files and system librariesdon't match the gcc version chosen.
I do think may be we should add something to the User's Guide for those users who are not using gcc as the name of their default Gnu compiler -- explain that theicc driver does an implicit call to"gcc -v" to figure out what version of Gnu to be compatible with...
BTW, we have the same problem with the Microsoft compiler... we try to look at what version of "cl" is in the user's path to determine MS compatibility version. The user can explicitly use the /Qvc option to override this.
I do think may be we should add something to the User's Guide for those users who are not using gcc as the name of their default Gnu compiler -- explain that theicc driver does an implicit call to"gcc -v" to figure out what version of Gnu to be compatible with...
BTW, we have the same problem with the Microsoft compiler... we try to look at what version of "cl" is in the user's path to determine MS compatibility version. The user can explicitly use the /Qvc option to override this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
What other considerations need to be taken when using this flag? If I have multiple versions of gcc on my system and use -gcc-version=, do I need to give the compiler further information in order to prevent the wrong headers and libs from linking? What if I have no gcc at all, is the intel compiler unuseable without an existing gcc installation?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
There are two flags that you may need in addition to -gcc-version to tell the compiler where the header/libraries are located:
-gcc-name=
name and location of gcc if not where expected
-gxx-name=
name and location of g++ if not where expected
The compiler will not work unless there is someGnu binutilsavailable because it doesn't have its own C/C++ headers, libraries, linker, etc.

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