Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Tianxiong_Lu
Beginner
133 Views

Compiler error "member member xxx already has an explicit dllexport/dllimport specifier"

Hi everyone,

I meet an error with Intel C++ compiler, Error message is following:
 

       icl -c /nologo /Zm200 /Qprec /Zc:wchar_t- /Zi /Od /MDd /GS /GR /EHsc /W3 -DUNICODE -DQT_LARGEFILE_SUPPORT -DMUPA
RSER_DLL -DMUPARSERLIB_EXPORTS -DMAKEDLL -DMUPARSER_BUILD -D_CRT_SECURE_NO_WARNINGS -DEM_VER="\"0300\"" -DEM_VERSION=030
0 -DBUILDNO="\"6128\"" -DTARGETNAME="\"muparser\"" -DQT_DISABLE_DEPRECATED_BEFORE -DDataStreamVersion=12 -DQT_DLL -DQT_S
CRIPT_LIB -DQT_SCRIPTTOOLS_LIB -DQT_GUI_LIB -DQT_HAVE_MMX -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPP
ORT -I"c:\Qt\4.8.4-icc64\include\QtGui" -I"c:\Qt\4.8.4-icc64\include\QtScriptTools" -I"c:\Qt\4.8.4-icc64\include\QtScrip
t" -I"c:\Qt\4.8.4-icc64\include" -I"..\..\..\easimotor3\include" -I"..\..\..\easimotor3\include\muParser" -I"c:\Qt\4.8.4
-icc64\include\ActiveQt" -I"tmp\moc\debug" -I"." -I"c:\Qt\4.8.4-icc64\mkspecs\win32-icc" -Fotmp\obj\debug\ @C:\Users\lut
x\AppData\Local\Temp\2\nm1028.tmp
muParserBase.cpp
../../../easimotor3/include/muParser/muParserBase.h(199): error: member member "std::numpunct<_Elem>::id [with _Elem=cha
r]" (declared at line 80 of "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\INCLUDE\xlocnum") already has an exp
licit dllexport/dllimport specifier
     class change_dec_sep : public std::numpunct<TChar>
                                   ^
         detected during instantiation of class "mu::ParserBase::change_dec_sep<TChar> [with TChar=mu::char_type={char}
]" at line 50 of "..\..\..\easimotor3\contrib\muParser\muParserBase.cpp"

compilation aborted for ..\..\..\easimotor3\contrib\muParser\muParserBase.cpp (code 2)
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Intel\Composer XE 2015\bin\intel64\icl.EXE"”: 返回代码“0x2”
Stop.
NMAKE : fatal error U1077: “"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\nmake.exe"”: 返回代码“0
x2”
Stop.

I found same message in Intel software website at https://software.intel.com/en-us/articles/cdiag1745. But there is not answer about how to fix it.

Is there anyone has some advice? Thank you.

 

0 Kudos
7 Replies
133 Views

Hi Tianxiong,

Does the same code build with VS compiler? If yes, it seems like a bug of Intel compiler. Could you please send me the code if it is ok? I've searched around and find the source of muParser from: http://muparser.beltoforion.de/mup_download.html (v2.2.4) and it builds ok with both 15.0 and 16.0 beta compilers on windows.

I build with: nmake -f makefile.vc (change CC and CXX from cl to icl). I am also using vs2012 which is the version you are using from your command line output.

If possible, also let me know which compiler you are using (send me the "icl /QV" output from cmd.exe).

Thanks,

Shenghong

Tianxiong_Lu
Beginner
133 Views

Hi shenghong,

Yes, it succeeded in VS compiler. The icl version is:

Intel(R) C++ Intel(R) 64 Compiler XE for applications running on Intel(R) 64, Version 15.0.2.179 Build 20150121
 

My muParser version is 2.1.0 (20111119). How can I send you the code? 

133 Views

Hi Tianxiong,

I've received your code in email and feedback you my investigation results. The issue is submitted to our problem system as DPD200373111. I'll update here if it is fixed.

I've also provided the workaround in the email. By the way, the test case is as below:

/*
    This test case is generated from muParser source code.
    
    Reproduced with latest beta (and v15.0 which is the version customer is using):
    16.0.0.063 Beta Build 20150527
    Reproduced with VC10 and VC14
    
    icl /MDd test.cpp
test.cpp(19): error: member member "std::numpunct<_Elem>::id [with _Elem=char]"
(declared at line 65 of "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\
INCLUDE\xlocnum") already has an explicit dllexport/dllimport specifier
                class CXX : public std::numpunct<T>
                                   ^
          detected during instantiation of class "test::ParserBase::CXX<T> [with
 T=char_type={char}]" at line 24

compilation aborted for test.cpp (code 2)    
    icl test.cpp -> works
    without dllexport -> works
    works with /MTd and /MT, fail with /MDd and /MD
    
    VS compiler: works with or without /MDd
*/
#include <locale>

typedef std::string::value_type char_type;
  
#define MUPARSER_EXPORT __declspec(dllexport)
// ICL work without dllexport
//#define MUPARSER_EXPORT

namespace test {
    class MUPARSER_EXPORT ParserBase
    {
        static std::locale xxxx;  ///< The locale used by the parser
    
        template<class T>
        class CXX : public std::numpunct<T>
        {
        };
    };

    std::locale ParserBase::xxxx = std::locale(std::locale::classic(), new CXX<char_type>());
}

int main() 
{
    return 0;
}

Thanks,

Shenghong

Tianxiong_Lu
Beginner
133 Views

Hi shenghong,

Thanks a lot. Yes it is works now after I replace /MDd and /MD with /MTd and /MT.  But it may be cause another problem. This is a dynamic library of another project. And most of them is build with /MD. Is there any problem by using /MD and /MT mixed in different library? It will cause link error or program crashed ? 

lutx

133 Views

Hi Lutx,

Hmm, it may cause issues when mixing the libraries, I'll suggest you to apply the 2nd woarkound in this case, to redefine the macro MUPARSER_EXPORT (from dllexport to empty), as below:

#undef MUPARSER_EXPORT
#define MUPARSER_EXPORT

(I've also send you the screenshot in the email about where to add the code). With this workaround, it'll not affect other code.

Thanks,

Shenghong

Tianxiong_Lu
Beginner
133 Views

Yes,I will try this way. Thanks .

 

133 Views

FYI, this issue is fixed in latest v16.0 Update 1 version. I've verified the fix. Please upgrade your compiler.

Thanks,

Shenghong

Reply