Arduino IDE 용 특정 보드 용 라이브러리를 만들고 있습니다. 라이브러리는 훌륭하게 작동하며 이제는 OO를 추가하기 위해 단계를 되돌리고 있습니다. 라이브러리에는 .c 및 .cpp 파일이 혼합되어 있습니다. 클래스를 추가하려면 .cpp 만 사용해야합니다.Arduino IDE는 .c 파일을 인식하지 못합니다.
이것은 LED.h 파일입니다. 여기
https://gist.github.com/SaraJo/182220fda82cbe30255fe95f59d4a6b4
는 LED.cpp 파일입니다.https://gist.github.com/SaraJo/1b3d6967d7bc2ef2e70d79025b755eb9
내가 오류는 다음과 같습니다 나는 아두 이노는이 .c로 .cpp 파일을보고있다 같은데요
In file included from /Users/sarachipps/Library/Arduino15/packages/Jewelbots/hardware/nRF51822/1.0.0/cores/JWB_nRF51822/Arduino.h:54:0,
from /Users/sarachipps/Library/Arduino15/packages/Jewelbots/hardware/nRF51822/1.0.0/cores/JWB_nRF51822/ble-nrf51822-master/source/main.c:49:
/Users/sarachipps/Library/Arduino15/packages/Jewelbots/hardware/nRF51822/1.0.0/cores/JWB_nRF51822/LED.h:12:1: error: unknown type name 'class'
class LED {
^
/Users/sarachipps/Library/Arduino15/packages/Jewelbots/hardware/nRF51822/1.0.0/cores/JWB_nRF51822/LED.h:12:11: error: expected '=', ',', ';', 'asm' or '__attribute__' before '{' token
class LED {
^
exit status 1
Error compiling for board JWB nRF51822(V1.0 32KB).
, 내가 설정해야 컴파일러 플래그가? 고맙습니다.
이 작업을 해 주셔서 감사합니다. –
선언문 (프로토 타입이라고도 함)과 정의 (필요한 경우, 즉'main.cpp'가 다른 사람이 호출하는 것을 선언하는 경우)에 'extern "C"'를 수행해야합니다.). main() 함수 자체는 필요하지 않습니다. C++ 컴파일러는 암시 적으로이를 수행 할 것을 알고 있습니다. – uliwitness