Type 'uint32_t' could not be resolved

后端 未结 3 2278
情书的邮戳
情书的邮戳 2021-02-15 13:52

I am working on a C++ program in Eclipse (3.8.1) CDT. I am using the gcc compiler on Debian 8. I\'m also using an open source library called opendnp3 written in C++, which requi

相关标签:
3条回答
  • 2021-02-15 14:40

    I know this question is old, but I feel it's worth mentioning that I was having this exact problem and was able to resolve it just be rebuilding the index: right-click the project, "Index", "Rebuild". You said that you had rebuilt the index and it didn't help; importantly, I did this after adding -std=c++11 to the command line for the compiler specified in the "CDT GCC Built-in Compiler Settings", which can be found by opening project properties and going to "C/C++ General", "Preprocessor Include Paths, Macros etc", "Providers" tab. You wouldn't, if I understand correctly, need to do this with GCC version 6+ as it defaults to C++14; I'm using GCC 5.4 myself.

    If that doesn't help, the best path for debugging the issue is probably to open the declaration for cstdint (the include file itself - so, right click cstdint within the #include directive, and choose "open declaration") - this will show you the included file, with sections greyed out if they are precluded via preprocessor macros (#ifdef and the like). You may be able to see immediately why uint32_t is not considered defined. In my case, the __cplusplus macro had an unsuitable value and this led me to adding -std=c++11 to the compiler command line as mentioned above - but I still needed to rebuild the index before the problem was fully resolved.

    0 讨论(0)
  • 2021-02-15 14:43

    After adding -std=c++11, do this:

    C/C++ General -> Paths and Symbols -> Symbols -> GNU C++

    Click Add on the left side and paste __GXX_EXPERIMENTAL_CXX0X__ (ensure to append and prepend two underscores) into Name and leave Value blank.

    0 讨论(0)
  • 2021-02-15 14:48

    Try to enable the CDT GCC Built-in Compiler Settings in Project>Properties>Preprocessor Includes>Providers.

    0 讨论(0)
提交回复
热议问题