Vscode-cpptools: identifier "time_t" is undefined

Created on 15 Oct 2017  ·  8Comments  ·  Source: microsoft/vscode-cpptools

2017-10-15 15-41-13
Enviroment is : Ubuntu 16.04 + vscode 1.17.1 + extension c/c++ 0.13.1
It tips "identifier "time_t" is undefined", but it can compile and run successfully. Hope it can be solve.

Language Service

Most helpful comment

Do your include paths match what's given by clang -v -E -x c++ - < /dev/null (with clang replaced by gcc or gcc if you're using those)? My include path intentionally doesn't have /usr/include/linux. The ordering we use for include paths seems fine in general.

All 8 comments

@TimRowe The options to compile and link the code are not the ones in the c_cpp_properties.json file. To remove the tip(s) you need to add the include folders in the c_cpp_properties.json.

用于编译和链接的选项和c_cpp_properties.json文件中的选项不同。在c_cpp_properties.json文件中添加相应的包含路径可以防止出现这类代码解析的错误提示。

@xueyunquan , I have set cpp_properties.json as default and it can go to definition with right click, see my screenshot.
qq 20171016194050
qq 20171016194144

???

I'm not able to repro the issue. What happens if you only use /usr/include in your include path? It's possible it's picking up time.h from a different include path file that requires certain defines set.

Okay, the issue starts to repro when "/usr/include/linux" is added to the includePath. Can you remove that path or is it required for other includes? The time.h under the Linux folder doesn't include a definition for time_t. We might have a bug where we choosing includePaths in the wrong order.

Do your include paths match what's given by clang -v -E -x c++ - < /dev/null (with clang replaced by gcc or gcc if you're using those)? My include path intentionally doesn't have /usr/include/linux. The ordering we use for include paths seems fine in general.

Closing due to no activity on this issue for almost 2 years. Please reopen if there is still an issue here.

Removing "/usr/include/x86_64-linux-gnu/libavutil" from the "includePath" section resolved this for me.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ecbrodie picture ecbrodie  ·  3Comments

montery8 picture montery8  ·  3Comments

vicatcu picture vicatcu  ·  3Comments

arl picture arl  ·  3Comments

narutse picture narutse  ·  3Comments