Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
196 Views

Intel C++ 19.1 Link error: unresolved Symbol with C++17

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

 

8 Replies
Highlighted
Moderator
196 Views

0 Kudos
Highlighted
196 Views

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.

 

0 Kudos
Highlighted
Moderator
196 Views

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

0 Kudos
Highlighted
196 Views

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

 

 

 

 

 

Highlighted
Moderator
196 Views

I've reported this bug to our Developer. Internal number is CMPLRIL0-32475. Thanks.

Highlighted
New Contributor I
196 Views

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

Highlighted
New Contributor I
196 Views

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.

Highlighted
New Contributor I
196 Views

I opened a SR for this 04589971