platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
138 stars 105 forks source link

Build & run does not work with CLion #69

Closed iSynth closed 6 years ago

iSynth commented 6 years ago

Hi!

I carefully read and repeated all the steps from the integration section http://docs.platformio.org/en/latest/ide/clion.html

When I run the build project, I get a lot of errors:

/home/a/Applications/CLion/bin/cmake/bin/cmake --build /home/a/Temp/cmake-build-debug --target PLATFORMIO_BUILD -- -j 2
[Wed Oct  4 16:24:13 2017] Processing uno (platform: atmelavr; board: uno; framework: arduino)
--------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
Collected 24 compatible libraries
Looking for dependencies...
Project does not have dependencies
Compiling .pioenvs/uno/src/main.o
Archiving .pioenvs/uno/libFrameworkArduinoVariant.a
Compiling .pioenvs/uno/FrameworkArduino/CDC.o
Compiling .pioenvs/uno/FrameworkArduino/HardwareSerial.o
src/main.c: In function 'setup':
src/main.c:3:3: warning: implicit declaration of function 'pinMode' [-Wimplicit-function-declaration]
pinMode(LED_BUILTIN, OUTPUT);
^
src/main.c:3:11: error: 'LED_BUILTIN' undeclared (first use in this function)
pinMode(LED_BUILTIN, OUTPUT);
^
src/main.c:3:11: note: each undeclared identifier is reported only once for each function it appears in
src/main.c:3:24: error: 'OUTPUT' undeclared (first use in this function)
pinMode(LED_BUILTIN, OUTPUT);
^
src/main.c: In function 'loop':
src/main.c:8:3: warning: implicit declaration of function 'digitalWrite' [-Wimplicit-function-declaration]
digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
^
src/main.c:8:16: error: 'LED_BUILTIN' undeclared (first use in this function)
digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
^
src/main.c:8:29: error: 'HIGH' undeclared (first use in this function)
digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
^
src/main.c:9:3: warning: implicit declaration of function 'delay' [-Wimplicit-function-declaration]
delay(1000);                       // wait for a second
^
src/main.c:10:29: error: 'LOW' undeclared (first use in this function)
digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
^
*** [.pioenvs/uno/src/main.o] Error 1
Indexing .pioenvs/uno/libFrameworkArduinoVariant.a
========================== [ERROR] Took 0.42 seconds ==========================
CMakeFiles/PLATFORMIO_BUILD.dir/build.make:57: recipe for target 'CMakeFiles/PLATFORMIO_BUILD' failed
make[3]: *** [CMakeFiles/PLATFORMIO_BUILD] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/PLATFORMIO_BUILD.dir/all' failed
make[2]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/all] Error 2
CMakeFiles/Makefile2:79: recipe for target 'CMakeFiles/PLATFORMIO_BUILD.dir/rule' failed
make[1]: *** [CMakeFiles/PLATFORMIO_BUILD.dir/rule] Error 2
Makefile:118: recipe for target 'PLATFORMIO_BUILD' failed
make: *** [PLATFORMIO_BUILD] Error 2

As an example I use a simple Blink sketch:

void setup() {
  // initialize digital pin LED_BUILTIN as an output.
  pinMode(LED_BUILTIN, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(1000);                       // wait for a second
  digitalWrite(LED_BUILTIN, LOW);    // turn the LED off by making the voltage LOW
  delay(1000);                       // wait for a second
}
iSynth commented 6 years ago

I understood what was happening, I missed the line #include