- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
this simple code snippet does not link under visual studio 2019 14.28.29910 (updated today to newest vs 2019 16.9.2)
a.cxx
#include<cmath>
int func(float a) {
return round(a);
}
int main()
{
return (int)func(5.0);
}
icl.exe -Qcxx-features -Qvc14.2 -Qstd=c++17 -O3 -Ob2 -Oi a.cxx
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.1 Build 20201112_000000
Copyright (C) 1985-2020 Intel Corporation. All rights reserved.
a.cxx
Microsoft (R) Incremental Linker Version 14.28.29913.0
Copyright (C) Microsoft Corporation. All rights reserved.
-out:a.exe
a.obj
a.obj : error LNK2019: unresolved external symbol __roundf referenced in function main
a.exe : fatal error LNK1120: 1 unresolved externals
The cmath headers redirects to __roundf which is defined in intrin0.h
__MACHINE(double __round(double))
dumpbin -disasm a.obj
Microsoft (R) COFF/PE Dumper Version 14.28.29913.0
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file a.obj
File Type: COFF OBJECT
main:
0000000000000000: 48 83 EC 28 sub rsp,28h
0000000000000004: B9 03 00 00 00 mov ecx,3
0000000000000009: 33 D2 xor edx,edx
000000000000000B: E8 00 00 00 00 call __intel_new_feature_proc_init
0000000000000010: 0F AE 5C 24 20 stmxcsr dword ptr [rsp+20h]
0000000000000015: 81 4C 24 20 40 80 or dword ptr [rsp+20h],8040h
00 00
000000000000001D: F3 0F 10 05 00 00 movss xmm0,dword ptr [_2il0floatpacket.0]
00 00
0000000000000025: 0F AE 54 24 20 ldmxcsr dword ptr [rsp+20h]
000000000000002A: E8 00 00 00 00 call __roundf
000000000000002F: F3 0F 2C C0 cvttss2si eax,xmm0
0000000000000033: 48 83 C4 28 add rsp,28h
0000000000000037: C3 ret
0000000000000038: 0F 1F 84 00 00 00 nop dword ptr [rax+rax]
00 00
?func@@YAHM@Z (int __cdecl func(float)):
0000000000000000: 48 83 EC 28 sub rsp,28h
0000000000000004: E8 00 00 00 00 call __roundf
0000000000000009: F3 0F 2C C0 cvttss2si eax,xmm0
000000000000000D: 48 83 C4 28 add rsp,28h
0000000000000011: C3 ret
0000000000000012: 0F 1F 80 00 00 00 nop dword ptr [rax]
00
0000000000000019: 0F 1F 80 00 00 00 nop dword ptr [rax]
00
Summary
11B .drectve
18 .pdata
4 .rdata
60 .text
10 .xdata
Is there a workaround or I it wrong?
Best regards
Frank
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
Do you see this issue only after upgrading to the latest VS-19 version?
I'm unable to reproduce your issue in my environment.
VS-19 version: 16.8.5
Microsoft (R) Incremental Linker Version 14.28.29337.0
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We updated from 14.25.28610 with Intel C++ 2020.1 to the newest VS 2019 with Intel oneAPI.
Intel 2020.4 doesn't work with the newest VS 2019 due to some C++ defines.
When I change to std::floorf it works (should also have worked the original way)
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
Thanks for reporting this issue. The latest version of VS-19 (16.9.2) is currently untested. The floor function issue is reproducible. We are working on this internally and will get back to you.
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Thank you for your answer.
On RHEL 7.9 with devtoolset-9 std::floorf, std::ceilf, std::round are not available!
We develop our product on windows and linux, so it have to compile on both platforms.
Therefore it would be necessary that under windows the intrinsics for floor ceil round work!
Will this be fixed in oneAPI version 2021.1.2?
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
This issue is fixed in oneAPI version 2021.1.2. Let me know if you face any difficulties.
Regards,
Subarna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the issue is still there in Intel oneAPI 2021.2.0!
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
this is the classic C++ compiler version which we use:
Intel(R) C++ Intel(R) 64 Compiler Classic for applications running on Intel(R) 64, Version 2021.2.0 Build 20210228_000000
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
the following location in vs 2019 "cmath" header is the culprit (same for ceil, floor, trunc etc.):
_NODISCARD _Check_return_ inline float round(_In_ float _Xx) noexcept /* strengthened */ {
#ifdef _M_CEE
return _CSTD roundf(_Xx);
#elif defined(__clang__)
return __builtin_roundf(_Xx);
#else // ^^^ __clang__ / !__clang__ vvv
return __roundf(_Xx);
#endif // __clang__
}
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I also have the same problem after upgrading to the oneAPI C++ classic. Have you found a proper solution for that or have any updates on this thread?
The version of the compilers I am using are:
- Visual Studio 2019 (16.9.4)
- Intel C++ Compiler Classic 2021.2.0.616.
Best regards,
Haifeng
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
as a workaround and to see if all our other code compiles and link I used the cmath include file from Visual Studio 2019 16.5.4 we have used before:
I copied
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.25.28610\include\cmath
to
C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.28.29910\include\cmath
then it compiles.
Using icx.exe is no option at the moment, since it does not provide all command line options we use.
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
thank you very much for your advice. I can confirm that replacing the cmath file works on my side.
According to my test, the ICC 2021.2.0.616 works with MSVC toolset 14.25.28610. An alternative workaround could be changing the default "MSVC Toolset Version" to "14.25.28610", so you do not need to replace the cmath file. I post the following workaround here just in case someone has the same problem:
1. Specify the toolset version by using CMake option: -DCMAKE_GENERATOR_TOOLSET="v142,version=14.25.28610".
for example: cmake .. -G "Visual Studio 16 2019" -DCMAKE_GENERATOR_TOOLSET="v142,version=14.25.28610
2. If you use Visual Studio to build your projects, you can switch to "Use Intel C++ Compile Classic" for all the projects, and build the solution from the Visual Studio.
3. If you use MSBuild, you need to set the following properties:
/p:PlatformToolset="Intel C++ Compiler 19.2" /p:VCToolsVersion=14.25.28610
for example: msbuild your_project.sln /p:Configuration=Release /maxcpucount:%NUMBER_OF_PROCESSORS% /p:PlatformToolset="Intel C++ Compiler 19.2" /p:Platform=x64 /p:VCToolsVersion=14.25.28610 /t:rebuild
Best regards,
Haifeng
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
we use cmake with ninja generator and intel compiler with vs 2019 runtime.
I hope Intel oneAPI 2021.2.1 icl classic will fix this trivial bug!
Best regards
Frank
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Frank,
This issue is fixed in update 2.
Regards,
Subarna
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A gentle reminder to confirm from your end before we close the ticket.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We haven't heard back from you. We are closing this thread, assuming your issue has been resolved. Please raise a new thread for any further assistance as this thread will no longer be monitored.
Thanks & Regards
Noorjahan.

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