Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

OpenMP linking problem

ijjys
Beginner
794 Views
Hi,

When I use the /Qopenmp compilation option, then at linking time the linker complains about some undefined references on a class destructor of my program. The thing is that without /Qopenmp, it compiles and links fine.

Is this a known bug? I cannot find a simple test case to show you the problem...

I use Visual 2008 with Intel compiler 11.1.065 [IA-32]

0 Kudos
8 Replies
ijjys
Beginner
794 Views
The .i files (preprocessed files) of the .obj that returns the linker error is exactly the same with and without "/Qopenmp". The difference is setting libiomp5md.lib, because it causes an unresolved reference of part of my code.



Thanks in advance!
0 Kudos
JenniferJ
Moderator
794 Views

Please check this article to make sure to link with only IntelC's openmp runtime: http://software.intel.com/en-us/articles/how-to-use-intelr-compiler-openmp-compatibility-libraries-on-windows/

Jennifer

0 Kudos
ijjys
Beginner
794 Views

I think I'm doing that well:

Compiling:

--------------
/c /O2 /Ob2 /I "G:\blabla\include" /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_SECURE_SCL=0" /D "_SECURE_SCL_THROWS=0" /D "_HAS_ITERATOR_DEBUGGING=0" /D "_WIN32" /D "__INTEL_COMPILER" /D "_SCL_SECURE_NO_DEPRECATE" /D "DEBUG" /D "CMAKE_INTDIR="Release"" /D "_WINDLL" /D "_MBCS" /EHsc /MD /GS /fp:fast /Fo"blabla.dir\Release\" /nologo /TP /Zm1000 /Qopenmp -w
--------------

Linking:

--------------
kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.libiphlpapi.lib /OUT:"G:\...blabla.dll" /VERSION:1.0 /INCREMENTAL /nologo /LIBPATH:"G:\....\Release" /MANIFEST /MANIFESTFILE:"blablat.dir\Release\blabla.dll.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:"G:\blabla.lib" /DLL DelayImp.lib /subsystem:console
--------------

Notice that even without linking libiomp5md.lib, the error appears. Its the same linking with it:

1>object1.obj : error LNK2001: smbolo externo "public: __thiscall A::~A(void)" (??1A@@QAE@XZ) sin resolver

The A class is not used there (only included on a included file). This destructor is the only symbol unresolved.

Thanks!

0 Kudos
JenniferJ
Moderator
794 Views
Can you attach the .i file? It looks like there is a bug when compiling with /Qopenmp.
Do you have any openmp pragma in the .i file? if not, try to remove /Qopenmp for this one file, it should build ok.

Use "private" if you'd prefer. Or use the Intel Premier Support.

thanks,
Jennifer
0 Kudos
ijjys
Beginner
794 Views
Hi,

I`ve answered using the private option. It`s OK the file submitted?

Thanks!
0 Kudos
JenniferJ
Moderator
794 Views

Thanks for the .i file.

There is a bug in the omp compilation. when /Qopenmp is applied, the .obj will have the symbol:

>>dumpbin /symbols n.obj | find /I "?1fest3@@QAE@XZ"

14E1 00000000 UNDEF notype () External | ??1fest3@@QAE@XZ (public: __thi

scall fest3::~fest3(void))


Using /Od /Ob0 doesn't work-around the problem. Well, let me see if the compiler engineer will have a work-around.

thanks,
Jennifer

0 Kudos
ijjys
Beginner
794 Views
It also happens with my x64 compiler.

Ok, I'm awaiting you answer


Thanks again!
0 Kudos
Alexander_W_Intel
794 Views
Hi,

the bug is finally fixed the Version 12.0 update 4 and later. There is no fix for the Version 11.1 - sorry. But there is a workaround for older versions.

The work-around: add a destructor instead of using the default one. The destructor can be empty. It's only important that it is defined explicitly.
Example:

[cpp]class A
{
public:
    A() {}
    ~A() {}
};
[/cpp]

Thanks,
Alex

0 Kudos
Reply