• 我在Arduino上使用arduino-esp8266库的项目。
  • 我进入项目的文件夹并执行:platformio init--ide clion --board esp07
  • 然后,我将项目的源文件复制到src文件夹中。
  • 我运行CLion,导入了项目,并发现自动完成和重构无法正常工作。
  • 我将arduino-esp8266库复制到了项目主文件夹中的lib文件夹中。
  • 我将CMakeListsPrivate.txt更改为如下形式:
  • CMakeListsPrivate.txt:
    set(ENV{PATH} "C:\\Users\\Defozo\\.atom\\packages\\platformio-ide\\penv\\Library\\bin;C:\\Users\\Defozo\\.atom\\packages\\platformio-ide\\penv\\Scripts;C:\\ProgramData\\Oracle\\Java\\javapath;D:\\Program Files (x86)\\Embarcadero\\Studio\\17.0\\bin;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\17.0\\Bpl;D:\\Program Files (x86)\\Embarcadero\\Studio\\17.0\\bin64;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\17.0\\Bpl\\Win64;C:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;D:\\Program Files\\OpenVPN\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Users\\Defozo\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\CMake\\bin;D:\\Anaconda2;D:\\Anaconda2\\Scripts;D:\\Anaconda2\\Library\\bin;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Nordic Semiconductor\\nrf5x\\bin\\;D:\\comapre;D:\\Program Files\\MATLAB\\R2009b\\runtime\\win64;D:\\Program Files\\MATLAB\\R2009b\\bin;D:\\Program Files\\LLVM\\bin;C:\\Program Files (x86)\\Skype\\Phone\\;D:\\Ruby22-x64\\bin;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;D:\\Program Files\\Java\\jdk1.8.0_74\\bin;D:\\apache-maven-3.3.9-bin\\bin;C:\\Users\\Defozo\\AppData\\Local\\atom\\bin;D:\\Program Files\\Docker Toolbox;C:\\ProgramData\\Oracle\\Java\\javapath;D:\\Program Files (x86)\\Embarcadero\\Studio\\17.0\\bin;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\17.0\\Bpl;D:\\Program Files (x86)\\Embarcadero\\Studio\\17.0\\bin64;C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\17.0\\Bpl\\Win64;C:\\Program Files (x86)\\Borland\\Delphi7\\Bin;C:\\Program Files (x86)\\Borland\\Delphi7\\Projects\\Bpl\\;C:\\Program Files (x86)\\Intel\\iCLS Client\\;C:\\Program Files\\Intel\\iCLS Client\\;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\DAL;C:\\Program Files (x86)\\Intel\\Intel(R) Management Engine Components\\IPT;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;C:\\Program Files (x86)\\NVIDIA Corporation\\PhysX\\Common;D:\\Program Files\\OpenVPN\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Git\\mingw64\\bin;C:\\Users\\Defozo\\.dnx\\bin;C:\\Program Files\\Microsoft DNX\\Dnvm\\;C:\\Program Files (x86)\\CMake\\bin;D:\\Anaconda2;D:\\Anaconda2\\Scripts;D:\\Anaconda2\\Library\\bin;C:\\Program Files (x86)\\Windows Live\\Shared;C:\\Program Files (x86)\\Nordic Semiconductor\\nrf5x\\bin\\;D:\\comapre;D:\\Program Files\\MATLAB\\R2009b\\runtime\\win64;D:\\Program Files\\MATLAB\\R2009b\\bin;D:\\Program Files\\LLVM\\bin;C:\\Program Files (x86)\\Skype\\Phone\\;D:\\Ruby22-x64\\bin;C:\\Program Files\\Intel\\WiFi\\bin\\;C:\\Program Files\\Common Files\\Intel\\WirelessCommon\\;D:\\Program Files\\Java\\jdk1.8.0_74\\bin;D:\\apache-maven-3.3.9-bin\\bin;C:\\Users\\Defozo\\AppData\\Local\\atom\\bin;D:\\Program Files\\Docker Toolbox")
    set(PLATFORMIO_CMD "C:\\Users\\Defozo\\.atom\\packages\\platformio-ide\\penv\\Scripts\\platformio.exe")
    
    SET(CMAKE_C_COMPILER "C:/Users/Defozo/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-gcc.exe")
    SET(CMAKE_CXX_COMPILER "C:/Users/Defozo/.platformio/packages/toolchain-xtensa/bin/xtensa-lx106-elf-g++.exe")
    SET(CMAKE_CXX_FLAGS_DISTRIBUTION "-fno-rtti -fno-exceptions -std=c++11 -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP07 -U__STRICT_ANSI__")
    SET(CMAKE_C_FLAGS_DISTRIBUTION "-std=gnu99 -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -Os -mlongcalls -mtext-section-literals -falign-functions=4 -ffunction-sections -fdata-sections -DARDUINO=20300 -DLWIP_OPEN_SRC -DF_CPU=80000000L -D__ets__ -DICACHE_FLASH -DPLATFORMIO=30300 -DESP8266 -DARDUINO_ARCH_ESP8266 -DARDUINO_ESP8266_ESP07 -U__STRICT_ANSI__")
    set(CMAKE_CXX_STANDARD 11)
    
    add_definitions(-DARDUINO=20300)
    add_definitions(-DLWIP_OPEN_SRC)
    add_definitions(-DF_CPU=80000000L)
    add_definitions(-D__ets__)
    add_definitions(-DICACHE_FLASH)
    add_definitions(-DPLATFORMIO=30300)
    add_definitions(-DESP8266)
    add_definitions(-DARDUINO_ARCH_ESP8266)
    add_definitions(-DARDUINO_ESP8266_ESP07)
    
    include_directories("D:/Arduino/2/laser_na_stacje_v2/src")
    
    include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/toolchain-xtensa/xtensa-lx106-elf/include")
    include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include")
    include_directories("$ENV{HOMEDRIVE}$ENV{HOMEPATH}/.platformio/packages/toolchain-xtensa/lib/gcc/xtensa-lx106-elf/4.8.2/include-fixed")
    
    file(GLOB_RECURSE Foo_SOURCES "D:/Arduino/2/laser_na_stacje_v2/lib/*.cpp")
    file(GLOB_RECURSE Foo_HEADERS "D:/Arduino/2/laser_na_stacje_v2/lib/*.h")
    
    set (Foo_INCLUDE_DIRS "")
    foreach (_headerFile ${Foo_HEADERS})
        get_filename_component(_dir ${_headerFile} PATH)
        list (APPEND Foo_INCLUDE_DIRS ${_dir})
    endforeach()
    list(REMOVE_DUPLICATES Foo_INCLUDE_DIRS)
    
    include_directories(${Foo_INCLUDE_DIRS})
    add_executable (laser_na_stacje_v2-2 ${Foo_SOURCES})
    
    FILE(GLOB_RECURSE SRC_LIST "D:/Arduino/2/laser_na_stacje_v2/src/*.*")
    
  • 然后我将CMakeLists.txt更改为此:
  • CMakeLists.txt:
    cmake_minimum_required(VERSION 3.2)
    project(laser_na_stacje_v2)
    
    include(CMakeListsPrivate.txt)
    
    add_custom_target(
        PLATFORMIO_BUILD ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion run
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_UPLOAD ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion run --target upload
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_CLEAN ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion run --target clean
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_TEST ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion test
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_PROGRAM ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion run --target program
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_UPLOADFS ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion run --target uploadfs
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_UPDATE_ALL ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion update
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_custom_target(
        PLATFORMIO_REBUILD_PROJECT_INDEX ALL
        COMMAND ${PLATFORMIO_CMD} -f -c clion init --ide clion
        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
    )
    
    add_executable(${PROJECT_NAME} src/laser_na_stacje_v2.cpp)
    
  • 完成该操作后,自动完成和重构就可以了。但是,我现在无法编译我的项目。

  • 当我选择PLATFORMIO_BUILD并单击“运行”时,我看到:
    "D:\Program Files\JetBrains\CLion 2017.1.1\bin\cmake\bin\cmake.exe" --build D:\Arduino\2\laser_na_stacje_v2\cmake-build-debug --target PLATFORMIO_BUILD -- -j 8
    [05/17/17 12:08:54] Processing esp07 (platform: espressif8266, board: esp07, framework: arduino)
    
    Verbose mode can be enabled via `-v, --verbose` option
    Collected 31 compatible libraries
    Looking for dependencies...
    Library Dependency Graph
    |-- <SPI> v1.0
    |-- <Adafruit BMP280 Library> v1.0.1
    |   |-- <Wire> v1.0
    |   |-- <Adafruit Unified Sensor> v1.0.2
    |   |-- <SPI> v1.0
    |-- <Adafruit_BMP085>
    |   |-- <Wire> v1.0
    |-- <ESP8266httpUpdate> v1.1
    |   |-- <ESP8266HTTPClient> v1.1
    |   |   |-- <ESP8266WiFi> v1.0
    |   |-- <ESP8266WiFi> v1.0
    |-- <EEPROM> v1.0
    |-- <DHT sensor library> v1.2.3
    |-- <serialReadPMValue>
    |-- <Json>
    |-- <WifiManager> v0.10
    |   |-- <DNSServer> v1.1.0
    |   |   |-- <ESP8266WiFi> v1.0
    |   |-- <ESP8266WebServer> v1.0
    |   |   |-- <ESP8266WiFi> v1.0
    |   |-- <ESP8266WiFi> v1.0
    |-- <ESP8266WiFi> v1.0
    Compiling .pioenvs\esp07\src\laser_na_stacje_v2.o
    Compiling .pioenvs\esp07\lib\SPI\SPI.o
    Compiling .pioenvs\esp07\lib\Adafruit_BMP280_Library\Adafruit_BMP280.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\Internals\JsonParser.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\Internals\List.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\Internals\Prettyfier.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\Internals\StaticStringBuilder.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\JsonArray.o
    Archiving .pioenvs\esp07\lib\libSPI.a
    Archiving .pioenvs\esp07\lib\libAdafruit_BMP280_Library.a
    Indexing .pioenvs\esp07\lib\libAdafruit_BMP280_Library.a
    Indexing .pioenvs\esp07\lib\libSPI.a
    Compiling .pioenvs\esp07\lib\ArduinoJson\JsonBuffer.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\JsonObject.o
    Compiling .pioenvs\esp07\lib\ArduinoJson\JsonVariant.o
    Archiving .pioenvs\esp07\lib\libArduinoJson.a
    Indexing .pioenvs\esp07\lib\libArduinoJson.a
    Linking .pioenvs\esp07\firmware.elf
    Calculating size .pioenvs\esp07\firmware.elf
    Building .pioenvs\esp07\firmware.bin
    text       data     bss     dec     hex filename
    379874    13232   31040  424146   678d2 .pioenvs\esp07\firmware.elf
     [SUCCESS] Took 4.73 seconds
    Built target PLATFORMIO_BUILD
    
    "D:\Program Files\JetBrains\CLion 2017.1.1\bin\cmake\bin\cmake.exe" --build D:\Arduino\2\laser_na_stacje_v2\cmake-build-debug --target laser_na_stacje_v2 -- -j 8
    Scanning dependencies of target laser_na_stacje_v2
    [  0%] Building CXX object CMakeFiles/laser_na_stacje_v2.dir/src/laser_na_stacje_v2.cpp.obj
    [100%] Linking CXX executable laser_na_stacje_v2.exe
    c:/users/defozo/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: unrecognized option '--out-implib'
    c:/users/defozo/.platformio/packages/toolchain-xtensa/bin/../lib/gcc/xtensa-lx106-elf/4.8.2/../../../../xtensa-lx106-elf/bin/ld.exe: use the --help option for usage information
    collect2.exe: error: ld returned 1 exit status
    CMakeFiles\laser_na_stacje_v2.dir\build.make:96: recipe for target 'laser_na_stacje_v2.exe' failed
    mingw32-make.exe[3]: *** [laser_na_stacje_v2.exe] Error 1
    CMakeFiles\Makefile2:399: recipe for target 'CMakeFiles/laser_na_stacje_v2.dir/all' failed
    mingw32-make.exe[2]: *** [CMakeFiles/laser_na_stacje_v2.dir/all] Error 2
    CMakeFiles\Makefile2:411: recipe for target 'CMakeFiles/laser_na_stacje_v2.dir/rule' failed
    mingw32-make.exe[1]: *** [CMakeFiles/laser_na_stacje_v2.dir/rule] Error 2
    mingw32-make.exe: *** [laser_na_stacje_v2] Error 2
    Makefile:234: recipe for target 'laser_na_stacje_v2' failed
    

    如果我选择laser_na_stacje_v2-2并单击“运行”:
    "D:\Program Files\JetBrains\CLion 2017.1.1\bin\cmake\bin\cmake.exe" --build D:\Arduino\2\laser_na_stacje_v2\cmake-build-debug --target laser_na_stacje_v2-2 -- -j 8
    [  0%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/ArduinoString_Tests.cpp.obj
    [  1%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Array_Tests.cpp.obj
    [  2%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Basic_Tests.cpp.obj
    [  3%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_NoMemory_Tests.cpp.obj
    [  3%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Object_Tests.cpp.obj
    [  4%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/GbathreeBug.cpp.obj
    [  5%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/IntegrationTests.cpp.obj
    [  5%] Building CXX object CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/Issue10.cpp.obj
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\DynamicJsonBuffer_Basic_Tests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\ArduinoString_Tests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:462: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Basic_Tests.cpp.obj' failed
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Basic_Tests.cpp.obj] Error 1
    mingw32-make.exe[3]: *** Waiting for unfinished jobs....
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\DynamicJsonBuffer_Array_Tests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:412: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/ArduinoString_Tests.cpp.obj' failed
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/ArduinoString_Tests.cpp.obj] Error 1
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:437: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Array_Tests.cpp.obj' failed
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Array_Tests.cpp.obj] Error 1
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\DynamicJsonBuffer_Object_Tests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\DynamicJsonBuffer_NoMemory_Tests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    compilation terminated.
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:512: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Object_Tests.cpp.obj' failed
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:487: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_NoMemory_Tests.cpp.obj' failed
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\GbathreeBug.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_Object_Tests.cpp.obj] Error 1
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/DynamicJsonBuffer_NoMemory_Tests.cpp.obj] Error 1
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:537: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/GbathreeBug.cpp.obj' failed
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/GbathreeBug.cpp.obj] Error 1
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\IntegrationTests.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:562: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/IntegrationTests.cpp.obj' failed
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/IntegrationTests.cpp.obj] Error 1
    D:\Arduino\2\laser_na_stacje_v2\lib\ArduinoJson\test\Issue10.cpp:7:25: fatal error: gtest/gtest.h: No such file or directory
     #include <gtest/gtest.h>
                             ^
    compilation terminated.
    mingw32-make.exe[3]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/Issue10.cpp.obj] Error 1
    CMakeFiles\laser_na_stacje_v2-2.dir\build.make:587: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/lib/ArduinoJson/test/Issue10.cpp.obj' failed
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/all' failed
    mingw32-make.exe[2]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/all] Error 2
    CMakeFiles\Makefile2:78: recipe for target 'CMakeFiles/laser_na_stacje_v2-2.dir/rule' failed
    mingw32-make.exe[1]: *** [CMakeFiles/laser_na_stacje_v2-2.dir/rule] Error 2
    mingw32-make.exe: *** [laser_na_stacje_v2-2] Error 2
    Makefile:117: recipe for target 'laser_na_stacje_v2-2' failed
    

    要使自动完成,重构和编译正常工作,我该怎么办?

    最佳答案

  • 创建您的项目文件夹$ mkdir ~/pio/test
  • 然后运行$ platformio init --ide clion --board nodemcuv2
  • 然后下载esp8266的源代码$ curl -o ~/pio/test/src/main.cpp https://raw.githubusercontent.com/platformio/platformio-examples/develop/espressif/esp8266-arduino-ota/src/main.cpp
    $ curl -o ~/pio/test/lib/ArduinoOTA/ArduinoOTA.cpp https://raw.githubusercontent.com/platformio/platformio-examples/develop/espressif/esp8266-arduino-ota/lib/ArduinoOTA/ArduinoOTA.cpp
    $ curl -o ~/pio/test/lib/ArduinoOTA/ArduinoOTA.h https://raw.githubusercontent.com/platformio/platformio-examples/develop/espressif/esp8266-arduino-ota/lib/ArduinoOTA/ArduinoOTA.h
  • 然后重复$ platformio init --ide clion --board nodemcuv2
  • 打开Clion。通过菜单导入该项目:文件>导入项目,然后指定项目配置文件platformio.ini
  • 所在的根目录
  • 生成项目(请勿运行):菜单:运行>生成

  • 有用的链接:http://tiestvangool.ghost.io/2017/01/12/ota-platformio-and-esp8266/http://docs.platformio.org/en/latest/ide/clion.html
    并使用此按钮for build project

    08-16 00:31