"임베디드 환경의 Effectice C++"에서 Scott Meyers가 제안한대로 새로운 연산자를 사용하려고했습니다.마이어스가 제안한 MCU 레지스터 추상화의 새로운 기능
DefaultMcuType::PortRegister* p = new(reinterpret_cast<void*>(0x05)) DefaultMcuType::PortRegister;
는 다음 나는 때라도 오류를 얻을 :
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