Community
cancel
Showing results for 
Search instead for 
Did you mean: 
mikeitexpert
New Contributor I
179 Views

error LNK2019: unresolved external symbol __floorf referenced in function main after updating VS2019

I was able to build my app using icl and MSVC2019 up until recently. I did upgrade/update by accident to MSVC 14.28.29910 and started getting the below error right after the update... below is the sample you could use to reproduce the error along with command line options I use ...

 

 

#include <cstdlib>
#include <cstdio>
#include <cmath>

int main(){
    printf("a = %f \n", floor(3.4f));
    return 0;
}

 

 

 

interestingly enough, same code is compiled and executes fine using MinGW GCC compiler, not the case for ICL though. below you can find the error message.

 

 

 

C:\Users\Mike-laptop\sample>gcc tmp\test.cpp

C:\Users\Mike-laptop\sample>a.exe
a = 3.000000

C:\Users\Mike-laptop\sample>icl tmp\test.cpp
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.2.254 Build 20200623
Copyright (C) 1985-2020 Intel Corporation.  All rights reserved.

test.cpp
Microsoft (R) Incremental Linker Version 14.28.29913.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
test.obj
test.obj : error LNK2019: unresolved external symbol __floorf referenced in function main
test.exe : fatal error LNK1120: 1 unresolved externals

C:\Users\Mike-laptop\sample>

 

 

 

0 Kudos
5 Replies
GouthamK_Intel
Moderator
149 Views

Hi Mike,

We are able to reproduce the error on our end, we are working on your issue internally and we will get back to you soon.

Meanwhile, could you please try floorf instead of floor in your code and let us know if your issue persists.

printf("a = %f \n", floor(3.4f));

to

printf("a = %f \n",floorf(3.4f));

 

Regards

Goutham

 

GouthamK_Intel
Moderator
96 Views

Hi Mike,

Could you please let us know whether the above-mentioned workaround helped or not?

Also, let us know the Intel Product version(Intel Parallel Studio XE / Intel oneAPI Toolkits) which you are currently using?


Regards

Goutham


mikeitexpert
New Contributor I
81 Views

Yes that partly worked around the problem ...

however, I need to know what is the viable solution when floor's argument is a C++ template variable. 

For now, I just had to change the variable types to flout variables (as opposed to template variables).

I currently use "ICL 19.1.2.254 Build 20200623" as part of Intel System Studio.

 

I am planning to upgrade to oneAPI HPC in near future.  I am not sure if it is a good upgrade though. Maybe you can elaborate further please ???

 

 

 

GouthamK_Intel
Moderator
54 Views

Hi Mike,

>>"I currently use "ICL 19.1.2.254 Build 20200623" as part of Intel System Studio."

We can see that you are currently using an older version of the Intel compiler which is not compatible with the latest version of Visual Studio. Either you can downgrade the Visual Studio to the supported version or upgrade the Intel compiler.

Please find the details of Intel® Compilers Compatibility with Microsoft Visual Studio* and Xcode*.

https://software.intel.com/content/www/us/en/develop/articles/intel-compilers-compatibility-with-mic...


>>"I am planning to upgrade to oneAPI HPC in near future. I am not sure if it is a good upgrade though. Maybe you can elaborate further please ???"

Currently, as you are using an older version of the Intel compiler, we recommend you to upgrade to Intel oneAPI to get the latest Intel compilers along with new additional features.

We can see that you are an Intel® System Studio User, so you can install Intel® oneAPI Base & IoT Toolkit which is equivalent to Intel System Studio. Please find the below link for more detail regarding the same.

https://software.intel.com/content/www/us/en/develop/tools/oneapi/commercial-base-iot.html#linklist_...

Please let us know if this helps. Have a Good day.


Thanks & Regards

Goutham


37 Views

Sadly this problem is still present with oneAPI 2021.2 icl and Visual C++ 19.28.29913 (VS 16.9.3).

Reply