VS Arduino
>> >> Names conflict causes linking crash
https://www.visualmicro.com/forums/YaBB.pl?num=1560067326

Message started by Kabron on Jun 9th, 2019 at 8:02am

Title: Names conflict causes linking crash
Post by Kabron on Jun 9th, 2019 at 8:02am
Attached sample project. When name of .ino file(MAX30100.ino) matches with included MAX30100.cpp linking stage outputs the following errors:
[code]core.a(main.cpp.o)*: (.literal._Z8loopTaskPv+0x4): undefined reference to setup()
core.a(main.cpp.o)*: (.literal._Z8loopTaskPv+0x8): undefined reference to loop()

Error linking for board M5Stack-Core-ESP32

core.a(main.cpp.o)*: In function loopTask(void*)
main.cpp:20: undefined reference to setup()
Debug build failed for project 'MAX30100'
main.cpp:23: undefined reference to loop()

collect2.exe*: error: ld returned 1 exit status[/code]

Arduino IDE does not output any errors.
Renaming .ino file to any different solves the problem.
But it is a definite BUG.
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=MAX30100.ZIP ( 40 KB | 1 Download )

Title: Re: Names conflict causes linking crash
Post by Visual Micro on Jun 9th, 2019 at 10:43am
Hi,

In the Arduino IDE the override file name is sketch_name.ino.cpp and in Visual Micro is is project_name.cpp. The override cancels the .ino files. We are looking at changing to same as arduino.

Title: Re: Names conflict causes linking crash
Post by Kabron on Jun 9th, 2019 at 11:17am
Thanks, Tim
It took a time to find WTF.

Title: Re: Names conflict causes linking crash
Post by Visual Micro on Jun 9th, 2019 at 11:28am
Thanks for the report, it's a tricky one. If you look towards the end of the verbose compiler output you will see that the file that is compiled, is temp folder/project_name.cpp. It's not possible to compile .ino files so they are combined into a .cpp in the temp folder. It is this process that causes conflict with using the project_name.cpp.

If you hit a problem in future feel free to post early but include the output requested at the top of the forum. It shows how we can see what is happening and solve any issues so it's useful.

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.