Community
cancel
Showing results for 
Search instead for 
Did you mean: 
crakarjax
Beginner
244 Views

Inappropriate "more than one instance of overloaded function..." with icpc v 10.0 - 11.1

Jump to solution
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@localh...




(u, v);
^

compilation aborted for test.cc (code 2)

The same code compiles fine with gcc version 4.1.2...

0 Kudos
1 Solution
Judith_W_Intel
Employee
244 Views
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

View solution in original post

10 Replies
Feilong_H_Intel
Employee
244 Views
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.

Thank you.
--
Feilong H.
Intel Developer Support

Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
crakarjax
Beginner
244 Views
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.
Ta...






crakarjax
Beginner
244 Views
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.
Judith_W_Intel
Employee
245 Views
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

View solution in original post

Om_S_Intel
Employee
244 Views

I can compiler the test caseusing icc forIntel64.

I am using gcc 4.4.0 development environment.

crakarjax
Beginner
244 Views
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...
jimdempseyatthecove
Black Belt
244 Views
It would be realy great if the error messages could include responses from FAQ

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);

^
Did you forget -gcc-version option?



Jim Dempsey
Judith_W_Intel
Employee
244 Views
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.
crakarjax
Beginner
244 Views
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?
Judith_W_Intel
Employee
244 Views

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