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

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

Title: Names conflict causes linking crash
Post by Kabron on Jun 9th, 2019 at 9: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 | 6 )

Title: Re: Names conflict causes linking crash
Post by Visual Micro on Jun 9th, 2019 at 11: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 12:17pm
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 12:28pm
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.

Visual Studio Ide for Arduino » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2019. All Rights Reserved.