Hello,
I think I found an edge case when using the vMicro plugin. When an Arduino sketch contains a empty .ino file and instead a .cpp file with the same name as the sketch gets used but from within a "src" folder, I can trigger an compiler error:
Building project code ...
"C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -I"C:\Files\Work\arduino\vmicro-project-structure-compiler-error\VMProject" -I"C:\Program Files (x86)\Arduino\libraries" -I"c:\program files (x86)\microsoft visual studio\2017\community\common7\ide\extensions\zczdsw33.wxq\Micro Platforms\default\debuggers" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries" -I"C:\Files\Work\arduino\vmicro-project-structure-compiler-error\libraries" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino" -I"C:\Program Files (x86)\Arduino\hardware\arduino\avr\variants\mega" MProject.cpp" -o MProject.cpp.o"
Error compiling project sources
error*: Project.cpp: No such file or directory
Build failed for project 'VMProject'
fatal error*: no input files
compilation terminated
Arduino seems to have no problem with it:
Compiling sketch...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" t.ino.cpp" -o t.ino.cpp.o"
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega2560 -DF_CPU=16000000L -DARDUINO=10807 -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\cores\\arduino" "-IC:\\Program Files (x86)\\Arduino\\hardware\\arduino\\avr\\variants\\mega" roject.cpp" -o roject.cpp.o"
...
Linking everything together...
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-gcc" -w -Os -g -flto -fuse-linker-plugin -Wl,--gc-sections,--relax -mmcu=atmega2560 -o " t.ino.cpp.o" roject.cpp.o" "C:\\Users\\Julian\\AppData\\Local\\Temp\\arduino_build_516851/core\\core.a" "-LC:\\Users\\Julian\\AppData\\Local\\Temp\\arduino_build_516851" -lm
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0 " "
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-objcopy" -O ihex -R .eeprom " "
"C:\\Program Files (x86)\\Arduino\\hardware\\tools\\avr/bin/avr-size" -A "
Sketch uses 656 bytes (0%) of program storage space. Maximum is 253952 bytes.
Global variables use 9 bytes (0%) of dynamic memory, leaving 8183 bytes for local variables. Maximum is 8192 bytes.
The project is using a folder structure similar to this one:
Which happens to be also a similar structure as it gets used now the Marlin 2.0.x firmware from where I found also this error.
See also:
https://www.visualmicro.com/forums/YaBB.pl?num=1543777515/0 I have created an empty sketch with such a folder structure which produces this error on github:
https://github.com/j54n1n/vmicro-project-structure-compiler-error If I understood the issue correctly the plugin is trying to link the compilation unit from the .ino file but can not find that file because it was not compiled for some reason. Could it be that it is some name clash issue?
Arduino uses for compiling:
- Sketch.ino -> Sketch.ino.cpp.o
- Sketch.cpp -> Sketch.cpp.o