'VS Code demote CLOCK_MONOTONIC as undefined
VS Code (v1.63.2), running on Linux Ubuntu 18.04, in the default setup denotes the CLOCK_MONOTONIC as undefined.
#include <time.h>
...
struct timespec start_time;
(void) clock_gettime(CLOCK_MONOTONIC, &start_time);
How should I configure VS code to have CLOCK_MONOTONIC defined?
Solution 1:[1]
The fix is to edit the c_cpp_properties.json to use gcc and define _POSIX_C_SOURCE=199309L. For example:
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_POSIX_C_SOURCE=199309L"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "c++14",
"intelliSenseMode": "linux-gcc-x64"
}
],
"version": 4
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Nadav |
