-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
When running upload, it gives the following error
/opt/clion-2017.1.1/bin/cmake/bin/cmake --build /home/rafael/arduino-cmake/cmake-build-debug --target upload -- -j 4
[ 7%] Building CXX object example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/CDC.cpp.obj
[ 7%] Building CXX object example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HID.cpp.obj
[ 14%] Building CXX object example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp.obj
[ 14%] Building CXX object example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp.obj
avr-g++: error: missing device or architecture after ‘-mmcu=’
avr-g++: error: missing device or architecture after ‘-mmcu=’
avr-g++: error: missing device or architecture after ‘-mmcu=’
example/CMakeFiles/mega_CORE.dir/build.make:86: recipe for target 'example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HID.cpp.obj' failed
make[3]: *** [example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HID.cpp.obj] Error 1
make[3]: ** Esperando que outros processos terminem.
example/CMakeFiles/mega_CORE.dir/build.make:62: recipe for target 'example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/CDC.cpp.obj' failed
make[3]: *** [example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/CDC.cpp.obj] Error 1
example/CMakeFiles/mega_CORE.dir/build.make:110: recipe for target 'example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp.obj' failed
make[3]: *** [example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial.cpp.obj] Error 1
avr-g++: error: missing device or architecture after ‘-mmcu=’
example/CMakeFiles/mega_CORE.dir/build.make:134: recipe for target 'example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp.obj' failed
make[3]: *** [example/CMakeFiles/mega_CORE.dir/usr/share/arduino-1.6.3/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp.obj] Error 1
CMakeFiles/Makefile2:223: recipe for target 'example/CMakeFiles/mega_CORE.dir/all' failed
make[2]: *** [example/CMakeFiles/mega_CORE.dir/all] Error 2
CMakeFiles/Makefile2:129: recipe for target 'example/CMakeFiles/upload.dir/rule' failed
make[1]: *** [example/CMakeFiles/upload.dir/rule] Error 2
Makefile:131: recipe for target 'upload' failed
make: *** [upload] Error 2
/exemple/CMakeLists.txt
# Set a variable for commands below
set(PROJECT_NAME example)
set(ARDUINO_C_FLAGS "-ffunction-sections -fdata-sections")
set(ARDUINO_CXX_FLAGS "${ARDUINO_C_FLAGS} -fno-exceptions")
set(ARDUINO_LINKER_FLAGS "-Wl,--gc-sections")
# Define your project and language
project(${PROJECT_NAME} C CXX)
set(${PROJECT_NAME}_BOARD mega)
# Define the source code
set(${PROJECT_NAME}_SRCS example.cpp)
# Define the port for uploading code to the Arduino
set(${PROJECT_NAME}_PORT /dev/ttyACM0)
# Command to generate code arduino firmware (.hex file)
generate_arduino_firmware(${PROJECT_NAME})
/exemple/exemple.cpp
#include <HardwareSerial.h>
#include "Arduino.h"
#define LED_PIN 13
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.begin(9600);
}
void loop() {
Serial.println("Example arduino project in CLion");
for (int i = 0; i < 2; i++) {
digitalWrite(LED_PIN, HIGH);
delay(100);
digitalWrite(LED_PIN, LOW);
delay(100);
}
delay(1000);
}
n cpp the Serial function turns red without a library
I need grateful help!
Metadata
Metadata
Assignees
Labels
No labels