Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic undefined reference (Read 1105 times)
Martinus118
Newbies
*
Offline


Posts: 2
Joined: Aug 12th, 2024
undefined reference
Sep 18th, 2024 at 9:56am
Print Post  
Compiling my small testprogram for a include I receive 
the message (several messages with the same error):

"ld.exe: SBR_Stepper_Include.cpp.o: in function setup()
SBR_Stepper_Include.ino:27: undefined reference to MStepper  init()"

The include is in the project directory and included with double quotes (#include "MStepper.h")
in arduino ide it compiles and runs without any errors, in 1.8.x and 2.3.x.

When I move the include (.h and .cpp) in a own directory under 'libraries' it works, but it is easyer to update and test the include when it is in the same directory
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: undefined reference
Reply #1 - Sep 18th, 2024 at 10:04am
Print Post  
Thanks for the report.

Can you run Build > Clean and then attach the full log with both of the below options enabled so we can see the entire build process:
vMicro > Compiler > Verbose
vMicro > Compiler > Show Build Properties

and also post of send us a screen grab of the "Tools>Options>vMicro>compability". That will allow us to confirm you have not changed the compatibility defaults.

« Last Edit: Sep 18th, 2024 at 9:42pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12186
Location: United Kingdom
Joined: Apr 10th, 2010
Re: undefined reference
Reply #2 - Sep 21st, 2024 at 4:55pm
Print Post  
Thanks for sending the info. Files in the project folder should be found correctly.

Please close the solution and zip the project folder then email it to us. If the project folder contains a sub folder called ".vs" you can delete that before zipping.

Thanks
  
Back to top
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: undefined reference
Reply #3 - Sep 25th, 2024 at 10:36am
Print Post  
Thanks for the project.

The root issue with compilation here is the MStepper.h and MStepper.cpp files are not part of the project (i.e. don't show in Solution Explorer).

If you close the project, and then open it using File > Open Arduino Project it will correct this and the project should compile as expected.

Alternatively you can manually add the files by right clicking the project and clicking Add > Exisitng Item.

This only has to be done once, and we will investigate why these weren't picked up automatically from the Tools > Options > vMicro > Compatability > Compile ALL Project Folder Sources setting being enabled.

(NOTE: We had to amend a few elements in the code to get it to compile in Arduino or vMicro for declarations not matching definitions on variable types, and ensuring the goPlus function was part of the MStepper class in the cpp).
« Last Edit: Sep 25th, 2024 at 1:13pm by Simon@Visual Micro »  
Back to top
IP Logged
 
Martinus118
Newbies
*
Offline


Posts: 2
Joined: Aug 12th, 2024
Re: undefined reference
Reply #4 - Sep 25th, 2024 at 11:56am
Print Post  
Thanks a lot, it works now as expected.
(I used an older intermediate copy of MStepper.h and MStepper.cpp; sorry for that.)
(but I should know this issue with the solution eplorer, or how VS functions, 20 years ago I worked and developed a lot with VisualStudio and C#....)

So you can close this topic.

best regards .m. Cool
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2695
Joined: Feb 13th, 2019
Re: undefined reference
Reply #5 - Sep 26th, 2024 at 4:55pm
Print Post  
The latest release (24.0926.0) is available from the top of the board below with the fix for this issue:
https://www.visualmicro.com/forums/YaBB.pl?board=VS_ARDUINO_EXT_RELEASES
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint