Open Mikolaj98p opened 5 years ago
@Mikolaj98p, it is the error I could not figure out when running on Windows for solving #8
I do not use Windows and have no development machine for Windows. Doing it under Parallels Desktop on the Mac is an exercise in frustration. You should probably follow the Arduino CMake instructions https://github.com/francoiscampbell/arduino-cmake/tree/dbd4fe372b9a0120325b429b3ed23c311ab3dc66#installing-clion--arduino-ide--mingw for setting up a CLion Arduino Dev environment on Windows.
@Mikolaj98p, if the instructions solve the problem then please let me know and I will add the link to the FAQ.
Now I have another error:
CMake Error at cmake/Platform/Arduino.cmake:2130 (message):
ALL_SRCS not set: must define SRCS or SKETCH for target untitled7
Call Stack (most recent call first):
cmake/Platform/Arduino.cmake:498 (required_variables)
CMakeLists.txt:18 (generate_arduino_firmware)
And after reload:
CMake Error at cmake/ArduinoToolchain.cmake:82 (message):
Could not find Arduino SDK (set ARDUINO_SDK_PATH)!
Call Stack (most recent call first):
cmake-build-debug/CMakeFiles/3.12.3/CMakeSystem.cmake:6 (include)
CMakeLists.txt:7 (project)
@Mikolaj98p, can you post your CMakeLists.txt file here, I think the same issue as #8 is showing up on your system.
I see you are using CLion 2018.2 and it does not support the full API used by the plugin. I thought I handled this in the code but it is possible that on Windows there are other differences that combine to expose a bug.
Can you upgrade to CLion 2018.3? or 2018.2 is the only version you can use?
CMakeLists.txt 2018.2 is only version that I can use.
The plugin is setting the SKETCH variable but for some reason leaving the line commented out.
If you uncomment line set(${PROJECT_NAME}_SKETCH untitled7.ino)
as in the file below, it should work:
cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(CMAKE_CXX_STANDARD 98)
set(PROJECT_NAME untitled7)
set(${PROJECT_NAME}_BOARD nano)
set(ARDUINO_CPU atmega328old)
project(${PROJECT_NAME})
# set(${PROJECT_NAME}_SRCS)
# set(${PROJECT_NAME}_HDRS)
# set(${PROJECT_NAME}_LIBS)
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
# add_subdirectory()
set(${PROJECT_NAME}_SKETCH untitled7.ino)
# set(${PROJECT_NAME}_PROGRAMMER avrispmkii)
set(${PROJECT_NAME}_PORT COM4)
# set(${PROJECT_NAME}_AFLAGS -v)
# set(nano.upload.speed 9600)
generate_arduino_firmware(${PROJECT_NAME})
I will take a look at the code and see what is causing this.
I can also use the instructions for Windows setup to see if I can get my Windows virtual machine working with CLion.
Had the same problem in CLion 2018.3.4 on Windows 10. Uncommenting the set...sketch call fixed it!
Just to add more information to this issue and #8 for you @vsch
For me using 2019.1 CMakeLists.txt generated like this
cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(CMAKE_CXX_STANDARD 17)
set(<@PROJECT_NAME@> untitled)
set(${<@PROJECT_NAME@>}_BOARD nano)
set(ARDUINO_CPU atmega328)
project(${<@PROJECT_NAME@>})
# set(${<@PROJECT_NAME@>}_SRCS)
# set(${<@PROJECT_NAME@>}_HDRS)
# set(${<@PROJECT_NAME@>}_LIBS)
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
# add_subdirectory()
# set(${<@PROJECT_NAME@>}_SKETCH untitled.ino)
set(${<@PROJECT_NAME@>}_PROGRAMMER avrispmkii)
# set(${<@PROJECT_NAME@>}_PORT /dev/cu.usbserial-00000000)
set(${<@PROJECT_NAME@>}_AFLAGS -v)
# set(nano.upload.speed 9600)
generate_arduino_firmware(${PROJECT_NAME})
However I had to modify it to this to get it to work
cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(CMAKE_CXX_STANDARD 17)
set(PROJECT_NAME untitled)
set(${PROJECT_NAME}_BOARD nano)
set(ARDUINO_CPU atmega328)
project(${PROJECT_NAME})
# set(${<@PROJECT_NAME@>}_SRCS)
# set(${<@PROJECT_NAME@>}_HDRS)
# set(${<@PROJECT_NAME@>}_LIBS)
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/)
# add_subdirectory()
set(${PROJECT_NAME}_SKETCH untitled.ino)
set(${PROJECT_NAME}_PROGRAMMER avrispmkii)
# set(${<@PROJECT_NAME@>}_PORT /dev/cu.usbserial-00000000)
set(${PROJECT_NAME}_AFLAGS -v)
# set(nano.upload.speed 9600)
generate_arduino_firmware(${PROJECT_NAME})
I'm having the same issue.
"C:\Program Files\JetBrains\CLion 2019.1\bin\cmake\win\bin\cmake.exe" -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - MinGW Makefiles" C:\Users\--------\CLionProjects\Tesla2 CMake Error at cmake/ArduinoToolchain.cmake:82 (message): Could not find Arduino SDK (set ARDUINO_SDK_PATH)! Call Stack (most recent call first): C:/Program Files/JetBrains/CLion 2019.1/bin/cmake/win/share/cmake-3.13/Modules/CMakeDetermineSystem.cmake:94 (include) CMakeLists.txt:4 (project)
My CMakeLists.txt is simple, and the setting of SKETCH is uncommented.
cmake_minimum_required(VERSION 2.8.4)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake)
set(PROJECT_NAME Tesla2)
project(${PROJECT_NAME})
set(${CMAKE_PROJECT_NAME}_SKETCH Tesla2.ino)
#### Uncomment below additional settings as needed.
set(${CMAKE_PROJECT_NAME}_BOARD mega)
# set(${CMAKE_PROJECT_NAME}_PORT /dev/ttyACM0)
# set(mega.build.mcu atmega2560)
# set(mega.upload.protocol wiring)
# set(mega.upload.speed 115200)
generate_arduino_firmware(${CMAKE_PROJECT_NAME})
I'm running it on Windows.
Nevermind, the above issue went away by itself after reopening CLion and allowing CMake to re-run.
@OscarVanL, the plugin does try to force CLion to reload CMakeLists.txt after creation. Something is causing failure to do so.
Do you have any exceptions in CLion?
I will try to get my Windows environment setup so I can debug on Windows. It seems to be an OS specific issue.
Hi vsch, I do get an error from CLion.
"Error running 'upload': Cannot run program "C:\Users\OscarVanL***\EDU\cmake-build-debug\EDU.elf" (in directory "C:\Users\OscarVanL***\EDU\cmake-build-debug"): CreateProcess error=193, %1 is not a valid Win32 application"
If I copy and paste my .ino source code and put it into the official Arduino application, it compiles and runs on my Arduino fine.
Just to add more information to this issue and #8 for you @vsch
For me using 2019.1 CMakeLists.txt generated like this
cmake_minimum_required(VERSION 2.8.4) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake) set(CMAKE_CXX_STANDARD 17) set(<@PROJECT_NAME@> untitled) set(${<@PROJECT_NAME@>}_BOARD nano) set(ARDUINO_CPU atmega328) project(${<@PROJECT_NAME@>}) # set(${<@PROJECT_NAME@>}_SRCS) # set(${<@PROJECT_NAME@>}_HDRS) # set(${<@PROJECT_NAME@>}_LIBS) # link_directories(${CMAKE_CURRENT_SOURCE_DIR}/) # add_subdirectory() # set(${<@PROJECT_NAME@>}_SKETCH untitled.ino) set(${<@PROJECT_NAME@>}_PROGRAMMER avrispmkii) # set(${<@PROJECT_NAME@>}_PORT /dev/cu.usbserial-00000000) set(${<@PROJECT_NAME@>}_AFLAGS -v) # set(nano.upload.speed 9600) generate_arduino_firmware(${PROJECT_NAME})
However I had to modify it to this to get it to work
cmake_minimum_required(VERSION 2.8.4) set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/cmake/ArduinoToolchain.cmake) set(CMAKE_CXX_STANDARD 17) set(PROJECT_NAME untitled) set(${PROJECT_NAME}_BOARD nano) set(ARDUINO_CPU atmega328) project(${PROJECT_NAME}) # set(${<@PROJECT_NAME@>}_SRCS) # set(${<@PROJECT_NAME@>}_HDRS) # set(${<@PROJECT_NAME@>}_LIBS) # link_directories(${CMAKE_CURRENT_SOURCE_DIR}/) # add_subdirectory() set(${PROJECT_NAME}_SKETCH untitled.ino) set(${PROJECT_NAME}_PROGRAMMER avrispmkii) # set(${<@PROJECT_NAME@>}_PORT /dev/cu.usbserial-00000000) set(${PROJECT_NAME}_AFLAGS -v) # set(nano.upload.speed 9600) generate_arduino_firmware(${PROJECT_NAME})
I had the same situation and changed the CMakeLists.txt the same way as above (getting rid of the <@ and @> and uncommenting set...SKETCH). Then I get this error:
CMake Error at cmake/Platform/Arduino.cmake:1829 (message): Sketch does not exist: C:/Users/[...]/test_11/test_11.ino
So I tried to create a new Arduino Sketch File from within CLion. Therefore, in the Project tab, I right-clicked on the folder test_11 -> New -> Arduino Sketch. Create New Sketck File dialog box opens, I enter test_11.ino (also tried just test_11), hit OK. Create New Sketck File dialog box closes. Nothing happens. Can't find any such file anywhere.
So I created a new Arduino Sketch File test_11.ino from the Arduino IDE and copied it to the test_11 folder.
Now reloading CMakeList.txt works without error. (except for "Some source files are located outside of CMakeLists.txt directory. You can change the project root or ignore this in future.")
But when I try to Run test_11 from CLion, I get:
[ 89%] Built target mega_CORE Scanning dependencies of target test_11 [ 92%] Building CXX object CMakeFiles/test_11.dir/test_11_test_11.ino.cpp.obj In file included from C:/Users/[...]/test_11/cmake-build-debug/test_11_test_11.ino.cpp:8:0: C:/Program Files (x86)/Arduino/hardware/arduino/avr/cores/arduino/Arduino.h:153:16: error: conflicting declaration of 'void setup()' with 'C' linkage void setup(void); ^ C:/Users/Marco/Documents/ETH/Master/Masterarbeit/Software/Arduino/test_11/test_11.ino:1:6: note: previous declaration with 'C++' linkage void setup() { ^ mingw32-make.exe[3]: [CMakeFiles/test_11.dir/test_11_test_11.ino.cpp.obj] Error 1 CMakeFiles\test_11.dir\build.make:65: recipe for target 'CMakeFiles/test_11.dir/test_11_test_11.ino.cpp.obj' failed mingw32-make.exe[2]: [CMakeFiles/test_11.dir/all] Error 2 CMakeFiles\Makefile2:140: recipe for target 'CMakeFiles/test_11.dir/all' failed CMakeFiles\Makefile2:152: recipe for target 'CMakeFiles/test_11.dir/rule' failed Makefile:143: recipe for target 'test_11' failed mingw32-make.exe[1]: [CMakeFiles/test_11.dir/rule] Error 2 mingw32-make.exe: [test_11] Error 2
(the test_11.ino file is just the standard one that gets created by the Arduino IDE: void setup() { // put your setup code here, to run once:
}
void loop() { // put your main code here, to run repeatedly:
} )
Any idea on what else I can try?
In the meantime I could resolve the above issue by adding #include "Arduino.h" to the test_11.ino file. (Sorry for not trying this before.) But now I just get the same error as stated here:
Hi vsch, I do get an error from CLion.
"Error running 'upload': Cannot run program "C:\Users\OscarVanL\EDU\cmake-build-debug\EDU.elf" (in directory "C:\Users\OscarVanL\EDU\cmake-build-debug"): CreateProcess error=193, %1 is not a valid Win32 application"
If I copy and paste my .ino source code and put it into the official Arduino application, it compiles and runs on my Arduino fine.
@OscarVanL have you solved this somehow?
@MarcoStalder, the project does not create Windows executables. You need to select a run configuration with name ending in "updload" and build it. This will result in the project being built and uploaded using the defined programmer.
@vsch, thank you for the prompt reply! That solved it. I kind of tried to do this before, but back then, since it didn't work with the preset settings, I changed the Target to mega_CORE (I intuitively thought that would make it run on the Arduino Mega). Instead I should have left the Target and just selected test_11 as the Executable, which I did now.
@vsch, I now created a list on what made it work for me (on Windows 10 with CLion 2019.1.2). This was originaly meant to be a crutch for my future self. But I figured, it might as well help others in my situation. Feel free to use and spread it in whatever form you like.
about Aduino Support Plugin for CLion:
In relation to the initial issue, I repeatedly got the error, and the problem was that it wasn't detecting my Windows Store version of the Arduino IDE, so I uninstalled it and downloaded the native Windows installer version instead, now it seems to detect it. I also experienced #8 on CLion 2019.1.
Same here... I was using the Windows store version of Arduino IDE. Guess we need to download/install direct from Arduino.
Peace & Love, John
On Fri, Jul 12, 2019, 1:11 AM Agent Revolution notifications@github.com wrote:
In relation to the initial issue, I repeatedly got the error, and the problem was that it wasn't detecting my Windows Store version of the Arduino IDE, so I uninstalled it and downloaded the native Windows installer version instead, now it seems to detect it. I also experienced
8 https://github.com/vsch/CLionArduinoPlugin/issues/8 on CLion 2019.1.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/vsch/CLionArduinoPlugin/issues/9?email_source=notifications&email_token=AC6N3XYI7PXSMXCQRDG3IXDP7A4B5A5CNFSM4G4GRXV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZZBTGA#issuecomment-510794136, or mute the thread https://github.com/notifications/unsubscribe-auth/AC6N3X3E4XLIJCZFAO5YPNDP7A4B5ANCNFSM4G4GRXVQ .
Hello I have error: