It’s a little hard to tell without seeing your project files; LNK1181 is a “file not found” error from the linker, so at a guess I’d say your CMakeLists.txt file is probably off - the actual error message text will give you a better idea of exactly where the problem lies.
cmake_minimum_required(VERSION 3.13)
#initialize pico-sdk from GIT
#(note this can come from environment, CMake cache etc.)
set(PICO_SDK_FETCH_FROM_GIT on)
#initialize the SDK based on PICO_SDK_PATH
#note: this must happen before the project()
set(PICO_SDK_PATH $ENV{PICO_SDK_PATH})
include(pico_sdk_import.cmake)
#include(pico_extras_import_optional.cmake)
project(tiny2040_RGB_blink C CXX ASM)
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(PICO_PICO_BLINK_PATH ${PROJECT_SOURCE_DIR})
#initialize the Raspberry Pi Pico SDK
pico_sdk_init()
//# add url via pico_set_program_url
//# example_auto_set_url(tiny2040_RGB_blink)
add_executable(tiny2040_RGB_blink
tiny2040_RGB_blink.c
)
//# pull in common dependencies
target_link_libraries(tiny2040_RGB_blink pico_stdlib)
//# create map/bin/hex file etc.
pico_add_extra_outputs(tiny2040_RGB_blink)
Output in Developer Command Prompt after executing ‘nmake’ command
[ 1%] Performing build step for 'ELF2UF2Build'
[100%] Built target elf2uf2
[ 2%] No install step for 'ELF2UF2Build'
[ 4%] Completed 'ELF2UF2Build'
[ 11%] Built target ELF2UF2Build
[ 13%] Building ASM object pico-sdk/src/rp2_common/boot_stage2/CMakeFiles/bs2_default.dir/compile_time_choice.S.obj
cl : Command line warning D9021 : no action performed
[ 14%] Linking ASM executable bs2_default.elf
Microsoft (R) Incremental Linker Version 14.35.32215.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:compile_time_choice.S.exe
/out:bs2_default.elf
CMakeFiles\bs2_default.dir\compile_time_choice.S.obj
LINK : fatal error LNK1181: cannot open input file 'CMakeFiles\bs2_default.dir\compile_time_choice.S.obj'
Please note that there is also a NMake fatal error U1077 in the output (for some reason it did not write entire output to .txt file after executing nmake > PATH/TO/OUTPUT.TXT).
Strangely today after starting VSCode from Developer Comand Prompt (executing ‘code’ command) the project has been built successfully.
Unfortunately I cannot verify if my .uf2 file works as intended because my Tiny 2040 stopped working (does not respond to boot and reset) after I desoldered debug pin headers yesterday.
I would still appreciate any guidance regarding flaws in my project.
If you enclose code in triple backticks ( ``` ) it stops the forum trying to apply formatting to it and makes everything more readable - I’ve added them into the above post for you :)