When I try to use the round() function, while passing a double as the parameter, VSCode shows me this error:
more than one instance of overloaded function "round" matches the argument list:
function "std::round(float __x)" (declared at line 1756 of "C:\msys64\usr\lib\gcc\x86_64-pc-msys\11.3.0\include\c++\cmath")
function "std::round(long double __x)" (declared at line 1760 of "C:\msys64\usr\lib\gcc\x86_64-pc-msys\11.3.0\include\c++\cmath")
argument types are: (double)
I'm using C++17 standard, as the __cplusplus macro expands to 201703L. And according to the information I found, round(double) should exists in this version.
Here's my code:
#include <iostream>
#include <cmath>
int main() {
std::cout << round(double(0)) << std::endl;
}
Judging from the error message, I suspect that maybe something is wrong with my c_cpp_properties:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\msys64\\usr\\lib\\gcc\\x86_64-pc-msys\\11.3.0\\include\\**",
"C:\\msys64\\usr\\lib\\gcc\\x86_64-pc-msys\\11.3.0\\include-fixed\\**",
"C:\\msys64\\usr\\include\\**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"compilerPath": "C:/msys64/usr/bin/g++.exe"
}
],
"version": 4
}
I just solve this problem for myself. I changed
includePathin c_cpp_properties.json fromto
. I get this list from typing
gcc -v -E -x c++ -in the terminal.Edit: I found an answered question regarding the meaning of the command: What are the GCC default include directories?