「埋め込み環境でのEffectice C++」のScott Meyersの提案にしたがって、プレースメントnew演算子を使用しようとしました。Meyersが提案したMCUレジスタ抽象化の新機能
DefaultMcuType::PortRegister* p = new(reinterpret_cast<void*>(0x05)) DefaultMcuType::PortRegister;
は、その後、私はfollwoingエラーを取得:
register.cc: In function 'int main()':
register.cc:30:90: error: no matching function for call to 'operator new(sizetype, void*)'
DefaultMcuType::PortRegister* p = new(reinterpret_cast<void*>(0x05)) DefaultMcuType::PortRegister;
^~~~~~~~~~~~
<built-in>: note: candidate: void* operator new(unsigned int)
<built-in>: note: candidate expects 1 argument, 2 provided
<built-in>: note: candidate: void* operator new(unsigned int, std::align_val_t)
<built-in>: note: no known conversion for argument 2 from 'void*' to 'std::align_val_t'
register.cc:30:35: warning: unused variable 'p' [-Wunused-variable]
DefaultMcuType::PortRegister* p = new(reinterpret_cast<void*>(0x05)) DefaultMcuType::PortRegister;
^
私は本当に私が間違っているのかを把握することはできません。
あなたは 'の#include' –
Mine