- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Visual Studio 14.9.19
Intel Parallel Studio XE 2020
Latest Windows 10
The following piece of code (VS project attached) fails to link with an error
1>ipo_1894819obj3.obj : : error LNK2019: unresolved external symbol wmemcmp referenced in function main
when built it in C++17 mode.
#include "stdafx.h" #include <string> #include <wchar.h> int main() { std::wstring a = L"Hallo"; std::wstring b = L"Dulla"; printf("%d\n", int(a == b)); // comment out this line and it will link fine printf("%d\n", wmemcmp(a.data(), b.data(), 5)); return 0; }
When I comment out the marked line, it links fine.
When I switch C++ standard to C++14 it builds fine, too.
As the line with the explicit call to "wmemcmp" does not cause any problems I have the impression that the wmemcmp used for the wstring comparison uses an erroneous function signature in C++17-mode only.
Regards, Frank
- Tags:
- CC++
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Optimization
- Parallel Computing
- Vectorization
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please refer to the Release Notes for support version of VS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sorry, that was a silly typo: my version is MS VS 2017 15.9.19
So I'm in the range of supported VS versions.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It compiled OK for me. Did I miss something?
C:\Temp\vah\vah2>icl c17.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
c17.cpp
Microsoft (R) Incremental Linker Version 14.16.27032.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:c17.exe
c17.obj
C:\Temp\vah\vah2>icl c17.cpp /std:c++14
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
c17.cpp
icl: NOTE: The Beta evaluation period for this product ends on 9-oct-2019 UTC.
Microsoft (R) Incremental Linker Version 14.16.27032.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:c17.exe
c17.obj
C:\Temp\vah\vah2>icl c17.cpp /std:c++11
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
icl: command line warning #10159: invalid argument for option '/std'
c17.cpp
icl: NOTE: The Beta evaluation period for this product ends on 9-oct-2019 UTC.
Microsoft (R) Incremental Linker Version 14.16.27032.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:c17.exe
c17.obj
C:\Temp\vah\vah2>icl c17.cpp /std:c++17
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
c17.cpp
icl: NOTE: The Beta evaluation period for this product ends on 9-oct-2019 UTC.
Microsoft (R) Incremental Linker Version 14.16.27032.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:c17.exe
c17.obj
C:\Temp\vah\vah2>notepad c17.cpp
#include "stdafx.h"
#include <string>
#include <wchar.h>
int main()
{
std::wstring a = L"Hallo";
std::wstring b = L"Dulla";
printf("%d\n", int(a == b)); // comment out this line and it will link fine
printf("%d\n", wmemcmp(a.data(), b.data(), 5));
return 0;
}
All header files remain the same for your .zip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It turns out that in the VS project there is a hidden .vs folder that contains some user settings. This .vs folder is missing in my zip file.
If you load my solution file, the default target is Debug/x64. This compiles fine.If you switch to Release/x64 I see my linking error.
If I compile for Debug/x86 or Release/x86 there are no errors.
Trying to reproduce the error with command line calls to icl I finally see the error with these settings:
C:\tmp\q2>icl c17.cpp /std:c++17 /MD Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121 Copyright (C) 1985-2019 Intel Corporation. All rights reserved. c17.cpp Microsoft (R) Incremental Linker Version 14.16.27035.0 Copyright (C) Microsoft Corporation. All rights reserved. -out:c17.exe c17.obj c17.obj : error LNK2019: Verweis auf nicht aufgelöstes externes Symbol "wmemcmp" in Funktion "main". c17.exe : fatal error LNK1120: 1 nicht aufgelöste Externe
It builds fine for all of these settings:
icl c17.cpp /std:c++17 icl c17.cpp /MD icl c17.cpp /std:c++17 /MT icl c17.cpp /std:c++14 /MD icl c17.cpp /std:c++14 /MT
If I comment out the line I mentioned (file d17.cpp and c17.cpp attached), it compiles fine:
C:\tmp\q2>icl d17.cpp /std:c++17 /MD Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121 Copyright (C) 1985-2019 Intel Corporation. All rights reserved. d17.cpp Microsoft (R) Incremental Linker Version 14.16.27035.0 Copyright (C) Microsoft Corporation. All rights reserved. -out:d17.exe d17.obj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I've reported this bug to our Developer. Internal number is CMPLRIL0-32475. Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is still broken in Intel 19.1
(Makes it impossible to use std::filesystem effectively)
C:\Users\acu\Downloads\c17_d17_cpp>icl c17.cpp /std:c++17 /MD
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.0.166 Build 20191121
Copyright (C) 1985-2019 Intel Corporation. All rights reserved.
c17.cpp
Microsoft (R) Incremental Linker Version 14.24.28316.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:c17.exe
c17.obj
c17.obj : error LNK2019: unresolved external symbol wmemcmp referenced in function main
c17.exe : fatal error LNK1120: 1 unresolved externals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sadly this bug has NOT been fixed in Update 1 of Compiler 2020.
This bug also causes problems when using <filesystem> and C++17 - link errors similar to above.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I opened a SR for this 04589971
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can this workaround be accepted?
$ cat test.cpp
extern "C"
extern inline const wchar_t * wmemchr(
wchar_t const* _S,
wchar_t _C,
size_t _N
)
{
for (; 0 < _N; ++_S, --_N)
if (*_S == _C)
return _S;
return 0;
}
int main()
{
const __wchar_t* ws = 0;
__wchar_t c = 0;
__builtin_wmemchr(ws, c, 0);
return 0;
}

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page