I'm wondering if anyone can help me with the following problem using
the Intel compiler (C++ 7.0) in the VS .NET environment and operator
new multiple definitions.
I converted a C++ VS 6 program over to VS .NET and everything compiled
just fine using the MS compiler. Then I installed the Intel C++ 7.0
compiler and tried to compile. (using Debug target) I got the following
error message:
-----------------------intel compiler error message----------------------
C:Program FilesMicrosoft Visual Studio .NETVc7include
ew(84):
error: exception specification is incompatible with that of previous function
"operator new[](size_t={unsigned int})" (declared at line 645 of
"C:Program FilesMicrosoft Visual Studio .NETVc7includecrtdbg.h")
_THROW1(std::bad_alloc); // allocate array or throw exception
or after commenting out the definition in crtdbg.h I get:
C:Program FilesMicrosoft Visual Studio .NETVc7include
ew(84):
error: exception specification is incompatible with that of previous function
"operator new[](size_t={unsigned int})" (declared at line 1315 of
"C:Program FilesMicrosoft Visual Studio .NETVc7atlmfcincludeafx.h")
_THROW1(std::bad_alloc); // allocate array or throw exception
^
------------------------------------------------------------------------
The problem seems to be the definition of operator new[] in the file
"crtdbg.h" or "afx.h" versus in the file "new". Both are MS.NET files.
"crtdbg.h" has:
extern "C++" {
void * __cdecl operator new[](size_t);
}
and the conflicting definition of operator new[] in the file "new":
void *__cdecl operator new[](size_t)
_THROW1(std::bad_alloc); // allocate array or throw exception
Not sure if this is a MS issue or Intel issue. I compiled with just the
preprocessor output to see if there were any differences between the
two compilers, but it appears both produce the same preprocessed
output. The MS compiler does not seem to complain while the intel
compiler does. I thought maybe it had something to do with namespaces.
File "new" does not define the operator new[] in std:: namespace. There
is also a definition of new[] in afx.h, such that if I comment out the
one in crtdbg.h, then it conflicts with the definintion in afx.h.
Any suggestions? I'd hate to have to starting modifying MS files just
to use the intel compiler.
Wayne
conflict with new[] using Intel Compiler vs. MS compiler
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

