Can't build my project

I’m using PlatformIO IDE inside VSCode on Windows machine.
When I run build task, it fails with error:
Executing task in folder light-switch: C:\Users\Oleg&Vika.platformio\penv\Scripts\pio.exe run <

Processing nanoatmega328 (platform: atmelavr; board: nanoatmega328; framework: arduino)
---------------------------------------------------------------------------------------------------------------------------------

Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelavr/nanoatmega328.html
PLATFORM: Atmel AVR (3.0.0) > Arduino Nano ATmega328
HARDWARE: ATMEGA328P 16MHz, 2KB RAM, 30KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
 - framework-arduino-avr 5.1.0
 - toolchain-atmelavr 1.50400.190710 (5.4.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 6 compatible libraries
Scanning dependencies...
Dependency Graph        
|-- <EtherCard>
|-- <EEPROM> 2.0        
Building in release mode
Compiling .pio\build\nanoatmega328\src\Current.cpp.o
Compiling .pio\build\nanoatmega328\src\Messaging.cpp.o
Compiling .pio\build\nanoatmega328\src\main.cpp.o
Compiling .pio\build\nanoatmega328\lib109\EtherCard\EtherCard.cpp.o
Compiling .pio\build\nanoatmega328\lib109\EtherCard\dhcp.cpp.o
Compiling .pio\build\nanoatmega328\lib109\EtherCard\dns.cpp.o 
avr-g++: fatal error: no input files
avr-g++: fatal error: no input files
compilation terminated.
avr-g++: fatal error: no input files
compilation terminated.
compilation terminated.
The system cannot find the path specified.
The system cannot find the path specified.
avr-g++: fatal error: no input files
The system cannot find the path specified.
compilation terminated.
avr-g++: fatal error: no input files
compilation terminated.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
*** [.pio\build\nanoatmega328\src\main.cpp.o] Error 1
avr-g++: fatal error: no input files
compilation terminated.
The system cannot find the path specified.
*** [.pio\build\nanoatmega328\lib109\EtherCard\dns.cpp.o] Error 1
*** [.pio\build\nanoatmega328\src\Messaging.cpp.o] Error 1
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
The system cannot find the path specified.
*** [.pio\build\nanoatmega328\src\Current.cpp.o] Error 1
The system cannot find the path specified.
*** [.pio\build\nanoatmega328\lib109\EtherCard\EtherCard.cpp.o] Error 1
*** [.pio\build\nanoatmega328\lib109\EtherCard\dhcp.cpp.o] Error 1
================================================== [FAILED] Took 0.75 seconds ==================================================
The terminal process "C:\Users\Oleg&Vika\.platformio\penv\Scripts\pio.exe 'run'" terminated with exit code: 1.

Also in --verbose mode it doesn’t tell anything different except printing full avr-g++ command.

I tried to execute that commend in PlatformIO CLI, and it gives me different error:

> avr-g++ -o .pio\build\nanoatmega328\lib109\EtherCard\dns.cpp.o -c -fno-exceptions -fno-threadsafe-statics -fpermissive -std=gnu++11 -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega328p -DPLATFORMIO=50003 -DARDUINO_AVR_NANO -DF_CPU=16000000L -DARDUINO_ARCH_AVR -DARDUINO=10808 -Ilib\EtherCard -IC:\Users\Oleg&Vika\.platformio\packages\framework-arduino-avr\cores\arduino -IC:\Users\Oleg&Vika\.platformio\packages\framework-arduino-avr\variants\eightanaloginputs lib\EtherCard\dns.cpp
At line:1 char:324
+ ... INO_ARCH_AVR -DARDUINO=10808 -Ilib\EtherCard -IC:\Users\Oleg&Vika\.pl ...
+                                                                 ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation     
marks ("&") to pass it as part of a string.
At line:1 char:402
+ ... packages\framework-arduino-avr\cores\arduino -IC:\Users\Oleg&Vika\.pl ...
+                                                                 ~
The ampersand (&) character is not allowed. The & operator is reserved for future use; wrap an ampersand in double quotation     
marks ("&") to pass it as part of a string.
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : AmpersandNotAllowed

I’m not sure if it’s related. Do you have any ideas, why it’s not building my project?
The files, which I’m trying to build, are accessible from project’s root.

Have you tried a different Windows username? Maybe the & in that is a shell-specific character.

I haven’t tried different username. Also, as I understand, it’s very hard to rename user’s folder on Win. Is it possible to wrap dir name in quotes?

For a quick test I would just recommend you add a new Windows user and install PlatformIO there.

PlatformIO relies on SCons as its underlying build system. It is supposed to properly escape paths like these… maybe it doesn’t in this special case.

If the changed username solves your problem, file an issue at Issues · platformio/platformio-core · GitHub to double check that it’s not a PlatformIO issue and it will probably result in an issue at GitHub - SCons/scons: SCons - a software construction tool.

1 Like

Yes, from different user account project builds without any error.

Thanks, you can use that as a workaround for now. This bug is now tracked in Building fails in Windows when "&" is in path · Issue #3746 · platformio/platformio-core · GitHub so it will hopefully get resolved.

I solved the issue by renaming my home folder.