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

Simple program using wide strings won't link using OneAPI Classic/Visual Studio 2019/C++17

AndrewC
New Contributor III
914 Views

Intel® C++ Compiler Classic – toolkit version: 2021.4.0, extension version 19.2.8.16, Package ID: w_oneAPI_2021.4.0.364

 

Set the C++ compiler language to C++17

I have reported this bug numerous times for 2 years.

It makes, for example, using std::filesystem impossible

 

#include <string>

int main()
{
std::wstring a(L"abc");
std::wstring b(L"cde");
bool result = a == b;

}

testwstring.obj : : error LNK2019: unresolved external symbol wmemcmp referenced in function "public: static int __cdecl std::_WChar_traits<wchar_t>::compare(wchar_t const * const,wchar_t const * const,unsigned __int64)

0 Kudos
1 Solution
HemanthCH_Intel
Moderator
732 Views

Hi,


The Intel C++ Classic Compiler will enter "Legacy Product Support" mode signaling the end of regular updates. For more details please refer to the below link:

https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.html


In the below link, a workaround is provided. You can use the workaround for this issue or you can migrate to the ICX compiler.

https://community.intel.com/t5/Intel-C-Compiler/Intel-C-19-1-Link-error-unresolved-Symbol-with-C-17/td-p/1179168


However, this issue is not shown in the ICX Compiler. So, could you please try to use the ICX compiler and let us know whether your issue is resolved or not?


Thanks & Regards,

Hemanth.


View solution in original post

0 Kudos
6 Replies
HemanthCH_Intel
Moderator
893 Views

Hi,

 

Thanks for reaching out to us.

 

We are able to reproduce your issue at our end using oneAPI 2021.4, VS 2019 16.10.3 on Windows Machine.

 

But, you can use "/MT" option as the workaround for resolving your issue.

 

In visual studio, go to Project >>properties >>C/C++ >> Commandline and add "/MT" in the "additional options" as shown in screenshot attached.

HemanthCH_Intel_0-1639138570005.png

 

 

Thanks & Regards,

Hemanth.

 

0 Kudos
AndrewC
New Contributor III
881 Views

Changing to /MT is not an option for us ( or likely anyone else). That's a completely different runtime  as opposed to /MD and incompatible with most other libraries and code.

My frustration is that I reported this maybe 2 years ago through the official support channel.

The workaround is to  define a version of _wmemcmp in a separate file

As I said, it makes using <filesystem> not possible which is quite annoying and we have to  use boost::filesystem as an alternate

0 Kudos
HemanthCH_Intel
Moderator
822 Views

Hi,

 

We are working on your issue and will get back to you soon.

  

Thanks & regards,

Hemanth.

 

0 Kudos
HemanthCH_Intel
Moderator
733 Views

Hi,


The Intel C++ Classic Compiler will enter "Legacy Product Support" mode signaling the end of regular updates. For more details please refer to the below link:

https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.html


In the below link, a workaround is provided. You can use the workaround for this issue or you can migrate to the ICX compiler.

https://community.intel.com/t5/Intel-C-Compiler/Intel-C-19-1-Link-error-unresolved-Symbol-with-C-17/td-p/1179168


However, this issue is not shown in the ICX Compiler. So, could you please try to use the ICX compiler and let us know whether your issue is resolved or not?


Thanks & Regards,

Hemanth.


0 Kudos
AndrewC
New Contributor III
717 Views

I confirm the issue is not present when using "Intel Compiler 2021".

I realize there is a workaround to add a user defined function to satisfy the linker issue.

Since this will not get fixed I will use either of these options.

0 Kudos
HemanthCH_Intel
Moderator
685 Views

Hi,


Thanks for accepting our solution. If you need any additional information, please post a new question as this thread will no longer be monitored by Intel.


Thanks & Regards,

Hemanth.


0 Kudos
Reply