Reputation: 593
I am using Keil uVision4 to develop on a STM32F2 device. I am trying to use C++, which should be possible with the armcc (correct me if I am wrong) supplied with the uVision toolchain. But uVision refuses to accept the standard C++ include way
#include <cstdint>
doesnt work while
#include <stdint.h>
works perfectly. When i open cstdint inside uVision (rightclick, open document ) , it opens the file, but as generic file, e.g. not as header file, without the fancy colors.
What am I missing? Both files are in the same folder C:\Keil\ARM\ARMCC\include and it doesnt make any difference whether I force the Compiler to use c++ (by appending --cpp) or not. Is uVision just unable to accept files without endings as header files?
Edit: In response to the answers (thank you for your time!): The error message would be:
#include <cstdint> and
#include <cstdint.h>
typedef uint32_t u32;
error: #20: identifier uint32_t is undefined
while
#include <stdint.h> and
#include <stdint>
typedef uint32_t u32;
and
#include <cstdint>
typedef std::uint32_t u32;
works perfectly.
which shows what the problem is. Thank you for your help!
Upvotes: 2
Views: 3329
Reputation: 5067
What symptoms are you getting to it not working? I.e. what is the error message? It may be that you only need a using namespace std
, or to prefix std:: in front of all the types, since the cstdint
header places its declarations in the std
namespace.
Note however, that cstdint
is a very new header, and may not be supported by your compiler. So you may have to settle for stdint.h
, which is just as good.
Upvotes: 1