我使用Keil uVision4在STM32F2器件上開發。 我正在嘗試使用C++,它應該可以與uVision工具鏈一起提供的armcc(糾正我,如果我錯了)。 但uVision不服標準C++包括道路Keil uVision4 armcc:使用C++標準包括<cstdint>
#include <cstdint>
不工作而
#include <stdint.h>
完美。 當我在uVision中打開cstdint(rightclick,打開文檔)時,它會打開文件,但是作爲通用文件,例如不作爲頭文件,沒有花哨的顏色。
我錯過了什麼?這兩個文件都在同一個文件夾 C:\ Keil \ ARM \ ARMCC \ include 並且它是否強制編譯器使用C++(通過追加--cpp)或沒有任何區別。 uVision只是無法接受沒有結尾的文件作爲頭文件?
編輯:在回答問題的答案(感謝您的時間!): 錯誤消息是:
#include <cstdint> and
#include <cstdint.h>
typedef uint32_t u32;
error: #20: identifier uint32_t is undefined
而
#include <stdint.h> and
#include <stdint>
typedef uint32_t u32;
and
#include <cstdint>
typedef std::uint32_t u32;
works perfectly.
這說明了什麼問題。感謝您的幫助!
嘗試複製'cstdint'並將其命名爲'cstdint.h'(不是解決方案,而是測試您的理論) – Praetorian
向我們顯示錯誤消息。 –
你知道''剛剛被添加到C++ 11中,對嗎?它不是C++ 98和C++ 03的一部分 –
sellibitze