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 Strange error message (Read 3812 times)
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Strange error message
Jan 9th, 2017 at 11:49am
Print Post  
Everything fine using this until I included my own 'c' and 'h' file. Now it won't compile in VisualMicro but is OK in Arduino 1.8.
The compile output is
Quote:
ccpgXmY5.ltrans3.ltrans.o*: In function TaskTemp

Error compiling for board Arduino Mega ADK
Debug build failed for project 'wind'
wind.ino:176: undefined reference to TableLookup(int)
 
collect2.exe*: error: ld returned 1 exit status

source code attached. 'TaskTemp' referred to in the message is the only one that calls  'TableLookup', and that  is declared and defined  in my added files.
  

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


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange error message
Reply #1 - Jan 9th, 2017 at 12:07pm
Print Post  
Hi,

Does Build>Rebuild fix the issue?
  
Back to top
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: Strange error message
Reply #2 - Jan 9th, 2017 at 12:18pm
Print Post  
No, tried several times to clean / rebuild. Also tried restarting VS Community 2015 (ver 14.0.25424.00 update 3) but same result
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange error message
Reply #3 - Jan 9th, 2017 at 3:13pm
Print Post  
I am not sure where the confusion is. With your code I get exactly the same error in the Arduino IDE as I do with Visual Micro. So maybe you can retest with exact same example in the Arduino IDE. The error from Arduino is shown below.

To resolve the error I simply changed the extension of your .c file to .cpp. Cpp files are easier for new Arduino users and will work how you expect. They do not always have to contain classes. 

Code
Select All
Linking everything together...
...

D:\System\WinTemp\cchpxEqb.ltrans1.ltrans.o: In function `TaskTemp':

C:\Users\tl\Documents\Arduino\wind/wind.ino:177: undefined reference to `TableLookup(int)'

collect2.exe: error: ld returned 1 exit status

Using library Arduino_FreeRTOS at version 9.0.0-1 in folder: C:\Users\tl\Documents\Arduino\libraries\Arduino_FreeRTOS
exit status 1
Error compiling for board Arduino Duemilanove or Diecimila.
 

  
Back to top
IP Logged
 
chris52
Junior Member
**
Offline


Posts: 47
Joined: Jan 9th, 2017
Re: Strange error message
Reply #4 - Jan 9th, 2017 at 5:18pm
Print Post  
Many thanks, renaming to C++ solved it. I still don't understand though why my system compiled OK with the Arduino IDE and yours didn't!
Anyway I'm very grateful for the fast support response so I'll now buy the 'pro' version. 
btw I don't think that cpp is easier (to learn) than c, or did you just mean that Arduino works better with cpp?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Strange error message
Reply #5 - Jan 9th, 2017 at 5:47pm
Print Post  
Hi,

It's possible you used different code when testing the arduino ide and missed the #include for the .h from either the .c and/or the .ino
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint