Type 'uint32_t' cannot be resolved

I am working on a C ++ program in Eclipse (3.8.1) CDT. I use the gcc compiler on Debian 8. I also use an open source library called opendnp3 written in C ++, which requires uint32_t to be allowed as a parameter in several method calls and constructors.

In opendnp objects, intellisense does not list

__uint32_t however, permission is permitted.

The type is defined in <cstdint>( <cstdint>resolves just fine). I can open the declaration and see " using ::uint32_t;" there.

In my search, I added -std=c++11to โ€œAll Settingsโ€ under โ€œC / C ++ Build -> Settings -> Tool Settings -> GCC C ++ Compiler", and I also rebuilt the project index and restarted Eclipse, but it still doesn't allow it.

Here's the code: Edited in a simple HelloWorld project to help diagnose the problem

#include <iostream>
#include <cstdint> //has uint32_t defined
using namespace std;

int main() {
    __uint32_t t = 0;  //resolves just fine
    uint32_t i = 0; //Type could not be resolved
    auto x = "123"; //C++ 11 working
    cout << "Foo!" << endl; // prints Foo!
    return 0;
}

CDT console after attempting to build:

23:10:52 **** Incremental Build configuration Debugging for the FOO project **** do everything make: nothing needs to be done for "everyone".

23:10:52 Build Finished (took 133 ms)

+5
source share
3 answers

, , , , , , : "", "". , , ; -std=c++11 , " CDT GCC", , " C/++", "" Include Paths, Macros .. "," ". , GCC 6+, ++ 14; GCC 5.4.

, - , , cstdint ( include - , cstdint #include " " ) - , (#ifdef ..). , uint32_t . __cplusplus , -std=c++11 , , , .

+4

CDT GCC Project > Properties > Preprocessor Includes > Providers.

+2

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

C / C ++ General โ†’ Paths and Symbols โ†’ Symbols โ†’ GNU C ++

Click the "button Addon the left side and paste __GXX_EXPERIMENTAL_CXX0X__(add and add two underscores) in Nameand leave it Valueblank.

0
source

All Articles