|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Nicolas Calimet <pov### [at] freefr> wrote:
> IIRC the distinction appeared in icc-8.1, and it was probably
> necessary due to the kind of problem you encountered.
The only problem is that ".o" files are ambiguous. The extension doesn't
indicate what kind of object file it is.
gcc and icc have no problems whatsoever in compiling C++ source files
as long as they are named appropriately (ie. eg. ".cc" or ".cpp" or
whatever). However, when they are used as a linker they have no way of
knowing that they should be linking in C++ mode instead of C mode.
You *can* actually use gcc (and probably icc) to link C++ binaries.
You just have to provide the proper -l options. g++ (and thus icpc) simply
uses these options by default. Otherwise there's probably little difference
between the two.
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Warp wrote:
> gcc and icc have no problems whatsoever in compiling C++ source files
> as long as they are named appropriately (ie. eg. ".cc" or ".cpp" or
> whatever). However, when they are used as a linker they have no way of
> knowing that they should be linking in C++ mode instead of C mode.
Actually, they do: The name mangling should be different, with C using
basically unmangled names, while for C++ the ABI is rather specific. After
all, that is why there is 'extern "C" ' in C++ ...
As such, unless something is very wrong, a linker can easily auto-detect
what it is dealing with. The C++ files will have mangled names according to
the ABI specification, assuming they do actually declare any C++ 'stuff'.
Thorsten
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |
| |
|
|
Thorsten Froehlich <tho### [at] trfde> wrote:
> As such, unless something is very wrong, a linker can easily auto-detect
> what it is dealing with. The C++ files will have mangled names according to
> the ABI specification, assuming they do actually declare any C++ 'stuff'.
If nothing else, the linker (well, gcc) could have a logic like
"hey, this is an undefined reference to something, but I know what it is,
it's a C++ function (or whatever); I'll try it again with C++ linking
options to see if it links".
--
- Warp
Post a reply to this message
|
|
| |
| |
|
|
|
|
| |