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
Hot Topic (More than 8 Replies) Strange compile errors (Read 3884 times)
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Strange compile errors
Oct 17th, 2019 at 9:36pm
Print Post  
When I compile a large program for a mega 2560, although VS 2019 does not flag any errors, I get the following errors at the end of the compilation:
Severity      Code      Description      Project      File      Line      Suppression State
Error            (.text.startup+0x96e): undefined reference to LogClass::BrokenLines            <artificial>            
Error            (.text.startup+0x8f2): undefined reference to LogClass::ActiveLines            <artificial>            
Error            (.text.startup+0x7f2): undefined reference to LogClass::State            <artificial>            
Error            (.text.startup+0x970): undefined reference to LogClass::BrokenLines            <artificial>            
Error            (.text.startup+0x7f0): undefined reference to LogClass::State            <artificial>            
Error            (.text.startup+0x8f0): undefined reference to LogClass::ActiveLines            <artificial>            
Error            error: ld returned 1 exit status            collect2.exe            
Warning            In function main            C:\Users\Abbott\AppData\Local\Temp\ccMkFEsR.ltrans0.ltrans.o            

These public Log Class properties are used throughout the project.

Code
Select All
// Log.h

#ifndef _LOG_h
#define _LOG_h

#if defined(ARDUINO) && ARDUINO >= 100
	#include "arduino.h"
#else
	#include "WProgram.h"
#endif

class LogClass
{
public:
	static void Init();
	static String ActiveLines;
	static String BrokenLines;
	static String FileName;
	static String FlowLast;
	static String FlowRate;
	static String FlowTot;
	static int FreeRam;
	static String HeaterTempF;
	static  bool IsRunning;
	static  int JsonLenAct;
		//todo Allocate 256b and allow value to be written
	static String Message;
	static String State;
	static String TempF;
	static String TimeDate;
	static String VacuumPsi;
	static String WebAction;
	static String WebRequest;
};
extern LogClass Log;
#endif 



I'm not sure how to approach finding my issue.
Thanks
Abbott

I've attached the  verbose and the logger.cpp which uses the log.h



  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #1 - Oct 18th, 2019 at 12:55pm
Print Post  
Please try clicking "build>clean solution" then build and repost the verbose output if there is still a problem.

  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #2 - Oct 18th, 2019 at 9:03pm
Print Post  
Same result.
I did a clean (usually works w/ asp.net & win-forms). When I did the build, a pointer to the various libraries was broken, so those includes were not found. When I add 1 library, the rest of the includes got resolved.
I've attached the latest verbose.
Thanks for the fast response.
Abbott
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #3 - Oct 19th, 2019 at 12:56pm
Print Post  
The "build>clean solution" clears the build cache for the avr core so that would give a fuller compiler output.

I notice one strange thing. You seem to be using a custom core. I suggest you move or delete the "documents/arduino/hardware/arduino" folder if you did not intent to use a custom core.

The build should then use the avr core installed with the arduino ide.
  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #4 - Oct 20th, 2019 at 8:06pm
Print Post  
I created a new project and added the h & cpp files and still got compile errors.

Thanks Abbott
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #5 - Oct 20th, 2019 at 8:45pm
Print Post  
please zip and email a failing example to the email address in the click ehere above. Also add a link to this post.

Thanks
  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #6 - Oct 21st, 2019 at 4:41pm
Print Post  
I've done that. As a test, I purchased an additional (3 machine) licence for vm to test on a productuin desktip I have. It failed with the same errors...Took me 3 hours to get the additional environment working properly .. uggh.
Abbott
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #7 - Oct 21st, 2019 at 5:40pm
Print Post  
Thanks for the project. It fails for me in both Visual Micro and the Arduino IDE with the same error. + see important note below.

Code (C++)
Select All
Enms.cpp:1: In file included from

Enms.h: 40:3: error: redeclaration of 'StartUp
   StartUp
   ^~~~~~~
Enms.h:27: note  previous declaration EnumsClass  State StartUp
   StartUp 



One point of note. Your library folders contain a version number but they are not added to the solution as shared libraries. Therefore both arduino and visual micro will reolve by first hunting for a .h with the same name as a lib folder. If for example, we find SPI.h then we will look for a library that has a folder name of SPI and use that library. Only if we can not find a library by folder name we then look for the .h in other library folders such as in lib folder "SPI-1.x.x"

Therefore by using the versioned library folder names you might cause confusion with where library headers are resolved from.

If you have clashes then you should ensure that you use the NoIDE option which prevents the ArduinoIDE\Libraries folder from being found and ensure you do not have both an SPI library and an SPI-1.x.x library in myDocuments\Arduino\Libraries. You should ensure the tool chain you are using such as AVR does not have an AVR\Libraries folder with an SPI folder.

Better still move you versioned libraries to another location and add them as shared project references. Visual Micro looks for shared library projects before performing the "arduino" library discovery logic. Therefore shared libraries always take presence and make it easier to locate the intended library version.
« Last Edit: Oct 21st, 2019 at 5:48pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #8 - Oct 23rd, 2019 at 12:24am
Print Post  
I believe I followed your instructions properly. Still get the errors. The libraries are all part of the project. I've attached to updated project library and the Verbose log.
Thanks
Abbott
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #9 - Oct 23rd, 2019 at 2:46pm
Print Post  
Please confirm it builds in the arduino ide. As I said the project source you provided failed in both arduino and visual micro.
  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #10 - Oct 23rd, 2019 at 5:09pm
Print Post  
It does NOT compile properly in the Arduino IDE. I've attached the error list
  

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


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange compile errors
Reply #11 - Oct 23rd, 2019 at 7:04pm
Print Post  
The best place for help with your own code is the forum at arduino.cc. That's where the arduino experts are. In this forum we can only help with Visual Micro issues.
  
Back to top
WWW  
IP Logged
 
Abbott HMG
Junior Member
**
Offline


Posts: 56
Location: Bedford, NY, USA
Joined: May 10th, 2019
Re: Strange compile errors
Reply #12 - Oct 24th, 2019 at 8:04pm
Print Post  
I agree. Sorry for the time wasted.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint