Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"128-bit floating-point types are not supported in this configuration" error when including any stl library in visual studio linux c++ project

so i created a c++ linux console application on my x64 bit win 10 pro 10.0.17134 with wsl.

the project compiles no problem, without showing any errors. and debugging basic variable assignments works as expected;

then when i try to include any stl library e.g. #include <iostream> i get the following errors

128-bit floating-point types are not supported in this configuration

error image

i am using Debug configuration with x64 bit mode. i also tried googling the error, but i can't seem to find any related answer

i also tried using different c++ versions (c++17,c++11,etc...) but i still get the same error.

but even though i get these compilation errors, the program still runs correctly.

like image 630
Ahmed Fwela Avatar asked Oct 01 '18 22:10

Ahmed Fwela


2 Answers

The compiler and the standard library are different things.

What you are seeing is a compiler that doesn't support 128 bit integers trying to use a std library that requires support for 128 bit integers.

The problem could be an Intelisense one, where Intelisense doesn't know that your compiler supports 128 bit integers or fails to properly exclude it or something. Your image shows you are seeing both Build and Intelisense errors; if the build succeeds that means those are Intelisense errors.

Intelisense is the MSVC tool that tries to parse and determine if you have errors in your C++ code. It doesn't use your compiler; rather, it uses a fast 3rd party compiler.

Turning Intelisense off may be the easiest way to get rid of those problems. Training Intelisense to get "proper" headers it understands is possible but quite difficult, and might be a many programmer-year project.

A quick hack would be to take your stdafx.h precompiled header, and do

#ifdef __INTELLISENSE__ 
using __float128 = long double; // or some fake 128 bit floating point type
#endif

but this can be an endless spiral.

There may also be ways to tell intellisense to ignore errors in certain files.

like image 124
Yakk - Adam Nevraumont Avatar answered Nov 15 '22 07:11

Yakk - Adam Nevraumont


If it does not conflict with the rest of your code, you can set __CUDACC__ in Project Properties | Configuration Properties > C/C++ > IntelliSense | Preprocessor Definitions

This is if you are using GCC headers. The switch may be different for other sources.

like image 24
cloud Avatar answered Nov 15 '22 05:11

cloud