我尝试通过CMake构建项目,几天前这个过程工作正常,但今天我得到命令cmake -G "NMake Makefiles" ..
后的错误:
CMake Error at CMakeLists.txt:8 (project):
Running
'nmake' '-?'
failed with:
The system cannot find the specified file
-- Configuring incomplete, errors occurred!
我正在使用Visual Studio代码,项目文件夹名称为“ADC_read”,我的CMakeLists.txt文件为:
# Set minimum required version of CMake
cmake_minimum_required(VERSION 3.12)
# Include build functions from Pico SDK
include($ENV{PICO_SDK_PATH}/external/pico_sdk_import.cmake)
# Set name of project (as PROJECT_NAME) and C/C standards
project(ADC_read C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
# Creates a pico-sdk subdirectory in our project for the libraries
pico_sdk_init()
# Tell CMake where to find the executable source file
add_executable(${PROJECT_NAME}
main.c
)
# Create map/bin/hex/uf2 files
pico_add_extra_outputs(${PROJECT_NAME})
# Link to pico_stdlib (gpio, time, etc. functions)
target_link_libraries(${PROJECT_NAME}
pico_stdlib adc_read hardware_adc
)
# Enable usb output, disable uart output
pico_enable_stdio_usb(${PROJECT_NAME} 1)
pico_enable_stdio_uart(${PROJECT_NAME} 0)
有人知道问题出在哪里吗?
=====================%编辑%=====================================半解析...
所以我仍然不能从Visual Studio代码构建项目(VSC找不到nmake
),但是从VS命令提示符构建可以很好地工作,所以我将坚持这样做。
1条答案
按热度按时间icnyk63a1#
试着删除你的
CMakeCache.txt
文件,因为它保存了你以前的生成器数据。然后你可以用cmake重新编译你的项目,它应该可以工作了!