VS Arduino
Visual Micro >> Project Guidance >> Don't understand these compiler errors
https://www.visualmicro.com/forums/YaBB.pl?num=1473543621

Message started by Jan Friberg on Sep 10th, 2016 at 9:40pm

Title: Don't understand these compiler errors
Post by Jan Friberg on Sep 10th, 2016 at 9:40pm
Using Visual Studio I get this error messages

Compiling debug version of 'WeatherDisplay' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'

Compiling 'WeatherDisplay' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'

WeatherDisplay.ino: 11:18: fatal error: user.h: No such file or directory
   #include "user.h"
   compilation terminated

Makes no sense to me because the file user.h is checked to indeed be in the same folder as the sketch

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 10th, 2016 at 10:02pm
If the .h actually included in the Visual Studio project?

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 10th, 2016 at 11:39pm

Tim@Visual Micro wrote on Sep 10th, 2016 at 10:02pm:
If the .h actually included in the Visual Studio project?


Yes here is part of my code where it seen included in the last line


Code (c++):

//Weather station V1.4
#include <TimeLib.h>
#include <Time.h>
#include <EEPROM.h>
#include <string.h>
#include <memorysaver.h>
#include <Wire.h>
#include <SdVolume.h>
#include <SdStream.h>
#include <SdInfo.h>
#include <SdFile.h>
#include <SdFatUtil.h>
#include <SdFatStructs.h>
#include <SdFatmainpage.h>
#include <SdFatConfig.h>
#include <SdFat.h>
#include <SdBaseFile.h>
#include <Sd2Card.h>
#include <ostream.h>
#include <MinimumSerial.h>
#include <istream.h>
#include <iostream.h>
#include <ios.h>
#include <bufstream.h>
#include <ArduinoStream.h>
#include <OneWire.h>
#include <UTFT.h>
#include <UTouch.h>
#include <DS1307RTC.h>
#include "user.h"



Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 11th, 2016 at 12:22pm
I meant is the .h actually included in the visual studio project (right click solution explorer include/exclude)

To save us some time it might be easier if you zip and email your project folder so I can look at your setup.

Thanks


Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 11th, 2016 at 2:24pm

Tim@Visual Micro wrote on Sep 11th, 2016 at 12:22pm:
I meant is the .h actually included in the visual studio project (right click solution explorer include/exclude)

To save us some time it might be easier if you zip and email your project folder so I can look at your setup.

Thanks



Not sure what you mean. Right clicking solution explorer does not show any include/exclude item. Do you mean the .h file should be listed under headers in the solution explorer. Tried adding it there and it didn't work. Other compiler errors.

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 11th, 2016 at 4:08pm
Hi,

The Visual Studio Solution Explorer has two modes. One where it shows all files on disk and the physical structure of the folders. The other shows a filtered view of virtual folders such as "Source", "Headers" etc.

Click the "project" in the solution explorer then you should see a small icon above the explorer called "Show all files". The button is a checkbox button that can be on or off.

A screen shot of the solution explorer with you right clicking the file would be useful.

email address is info[at]visualmicro.com

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 11th, 2016 at 5:42pm

Tim@Visual Micro wrote on Sep 11th, 2016 at 4:08pm:
Hi,

The Visual Studio Solution Explorer has two modes. One where it shows all files on disk and the physical structure of the folders. The other shows a filtered view of virtual folders such as "Source", "Headers" etc.

Click the "project" in the solution explorer then you should see a small icon above the explorer called "Show all files". The button is a checkbox button that can be on or off.

A screen shot of the solution explorer with you right clicking the file would be useful.

email address is info[at]visualmicro.com


Screenshot mailed

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 11th, 2016 at 9:17pm
thanks. please zip and email the project so I can try it.

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 11th, 2016 at 9:22pm

Tim@Visual Micro wrote on Sep 11th, 2016 at 9:17pm:
thanks. please zip and email the project so I can try it.


Have done so now.

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 11th, 2016 at 10:08pm
Thanks. It did not have #include  "user.h" in the code but I added it and got compile errors related to the user.h so it was found okay.

I assume you are on the most recent version of visual micro 1609.9?

Please switch on the "verbose" and "show build properties" then build and email the output as .txt

Thanks

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 12th, 2016 at 7:09pm

Tim@Visual Micro wrote on Sep 11th, 2016 at 10:08pm:
Thanks. It did not have #include  "user.h" in the code but I added it and got compile errors related to the user.h so it was found okay.

I assume you are on the most recent version of visual micro 1609.9?

Please switch on the "verbose" and "show build properties" then build and email the output as .txt

Thanks


I first tried removing include user.h and forgot to put it back
I also assume I use the latest visual micro since I don't get any notification about available update and have recently made an upgrade. But I don't see how I can see which version I have.
I have mailed the output as requested

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 12th, 2016 at 7:19pm
Okay well you reported the user.h wasn't being found. Maybe that was a cashing issues that was resolved after update or vm or restart of ide.

The compile errors in the output you sent show the user.h is being discovered correctly.

[code]
WeatherDisplay.ino: 32:14: error: redefinition of 'tmElements_t tm
   tmElements_t tm

WeatherDisplay.ino:10: In file included from
user.h:10: note  tmElements_t tm previously declared here
   tmElements_t tm;        \\Declare tmElements object to store time & date from DS3231

WeatherDisplay.ino: 34:7: error: redefinition of 'float T_outmax
   float T_outmax, T_outmin, T_inmax, T_inmin

WeatherDisplay.ino:10: In file included from
user.h:12: note  float T_outmax previously declared here
   float T_outmax,T_outmin,T_inmax,T_inmin

WeatherDisplay.ino: 34:17: error: redefinition of 'float T_outmin
   float T_outmax, T_outmin, T_inmax, T_inmin

WeatherDisplay.ino:10: In file included from
user.h:12: note  float T_outmin previously declared here
   float T_outmax,T_outmin,T_inmax,T_inmin

WeatherDisplay.ino: 34:27: error: redefinition of 'float T_inmax
   float T_outmax, T_outmin, T_inmax, T_inmin

WeatherDisplay.ino:10: In file included from
user.h:12: note  float T_inmax previously declared here
   float T_outmax,T_outmin,T_inmax,T_inmin

WeatherDisplay.ino: 34:36: error: redefinition of 'float T_inmin
   float T_outmax, T_outmin, T_inmax, T_inmin

WeatherDisplay.ino:10: In file included from
user.h:12: note  float T_inmin previously declared here
   float T_outmax,T_outmin,T_inmax,T_inmin

WeatherDisplay.ino: In function boolean Write2RTCAlarmMemory()

WeatherDisplay.ino: 465:24: error: 'DS1307_CTRL_ID' was not declared in this scope
   Wire.beginTransmission(DS1307_CTRL_ID)

WeatherDisplay.ino: In function boolean ReadRTCAlarmMemory()

WeatherDisplay.ino: 482:24: error: 'DS1307_CTRL_ID' was not declared in this scope
   Wire.beginTransmission(DS1307_CTRL_ID)
Error compiling project sources
[/code]

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 12th, 2016 at 8:45pm
Now I don't understand why I get these compiler errors

Compiling debug version of 'WeatherDisplay' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'

ccu2B6Ag.ltrans1.ltrans.o*: In function DisplayHeaders()
ccu2B6Ag.ltrans1.o*: (.text+0x540): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0x542): undefined reference to SevenSegmentFull

ccu2B6Ag.ltrans1.ltrans.o*: In function loop
ccu2B6Ag.ltrans1.o*: (.text+0xc3c): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0xc3e): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0xfd6): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.ltrans.o*: ccu2B6Ag.ltrans1.o:(.text+0xfd8): more undefined references to SevenSegmentFull follow

collect2.exe*: error: ld returned 1 exit status

Error compiling for board Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 12th, 2016 at 9:45pm
Do you get a problem in arduino ide?

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 13th, 2016 at 4:16pm

Tim@Visual Micro wrote on Sep 12th, 2016 at 9:45pm:
Do you get a problem in arduino ide?


Yes but not the same error messages but instead this

Arduino: 1.6.11 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino: In function 'void DisplayTime()':

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:146:25: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

   myGLCD.print(":",64,19);

                         ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino: In function 'void DisplayTemp(char*, char)':

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:194:39: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    {blank=32;myGLCD.print(" ",LEFT,184);}

                                       ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:199:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print(" ",LEFT+4*32,184);

                                  ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:206:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("  Max",146,169);

                                ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:207:30: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("   ",162,184);

                              ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:212:34: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("Max    ",144,169);

                                  ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:213:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("    ",172+(8*(strlen(tempstr))-1),184);

                                                       ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:215:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("    ",204,184);

                               ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:222:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print(" Min    ",162,201);

                                   ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:223:28: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print(" ",162,216);

                            ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:228:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("Min   ",144,201);

                                 ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:229:55: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

    myGLCD.print("    ",172+(8*(strlen(tempstr))-1),216);

                                                       ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:248:41: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

   myGLCD.print("Error header",CENTER,222);

                                         ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino: In function 'void DisplayHeaders()':

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:256:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Klockan",LEFT,1);

                               ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:257:40: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Termometrar (C)",LEFT,71);

                                        ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:258:33: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Utomhus",LEFT,169);

                                 ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:259:35: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Hygrometer",RIGHT,1);

                                   ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:260:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("%",RIGHT,51);

                           ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:261:32: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Inomhus",LEFT,93);

                                ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:262:27: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Max",144,95);

                           ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:263:28: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Min",144,127);

                            ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:264:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("Baromet",206,95);

                               ^

C:\Users\Jan Work\Documents\Arduino\WeatherDisplay\WeatherDisplay.ino:265:31: warning: deprecated conversion from string constant to 'char*' [-Wwrite-strings]

  myGLCD.print("(mmHg)",214,111);

                               ^

C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o: In function `DisplayHeaders()':

ccXy8rOY.ltrans1.o:(.text+0x540): undefined reference to `SevenSegmentFull'

ccXy8rOY.ltrans1.o:(.text+0x542): undefined reference to `SevenSegmentFull'

C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o: In function `loop':

ccXy8rOY.ltrans1.o:(.text+0xc3c): undefined reference to `SevenSegmentFull'

ccXy8rOY.ltrans1.o:(.text+0xc3e): undefined reference to `SevenSegmentFull'

ccXy8rOY.ltrans1.o:(.text+0xfd6): undefined reference to `SevenSegmentFull'

C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o:ccXy8rOY.ltrans1.o:(.text+0xfd8): more undefined references to `SevenSegmentFull' follow

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling for board Arduino/Genuino Mega or Mega 2560.
Library is already installed: Time version 1.5.0

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.


Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 13th, 2016 at 5:53pm
Same error

If you switch on the visual micro warnings you will also see the warnings you see in the arduino ide.

However the error is the same just spaced out more in arduino

Here is the error shown in the arduino ide report you have posted


Code (]C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o: In function `DisplayHeaders()':
ccXy8rOY.ltrans1.o:(.text+0x540): undefined reference to `SevenSegmentFull'
ccXy8rOY.ltrans1.o:(.text+0x542): undefined reference to `SevenSegmentFull'
C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o: In function `loop':
ccXy8rOY.ltrans1.o:(.text+0xc3c): undefined reference to `SevenSegmentFull'
ccXy8rOY.ltrans1.o:(.text+0xc3e): undefined reference to `SevenSegmentFull'
ccXy8rOY.ltrans1.o:(.text+0xfd6): undefined reference to `SevenSegmentFull'
C:\Users\JANWOR~1\AppData\Local\Temp\ccXy8rOY.ltrans1.ltrans.o:ccXy8rOY.ltrans1.
o:(.text+0xfd8): more undefined references to `SevenSegmentFull' follow

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




and this is what you posted earlier from visual micro

[code]ccu2B6Ag.ltrans1.ltrans.o*: In function DisplayHeaders()
ccu2B6Ag.ltrans1.o*: (.text+0x540): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0x542): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.ltrans.o*: In function loop
ccu2B6Ag.ltrans1.o*: (.text+0xc3c): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0xc3e): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.o*: (.text+0xfd6): undefined reference to SevenSegmentFull
ccu2B6Ag.ltrans1.ltrans.o*: ccu2B6Ag.ltrans1.o:(.text+0xfd8): more undefined references to SevenSegmentFull follow

collect2.exe*: error: ld returned 1 exit status


Looks like the error is

[code] undefined reference to SevenSegmentFul[/code]


Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 13th, 2016 at 6:23pm

Tim@Visual Micro wrote on Sep 13th, 2016 at 5:53pm:
Looks like the error is

Code:

undefined reference to SevenSegmentFul




And I certainly don't understand why this is an error. In my user.h I have

Code (c++):

extern                  uint8_t SevenSegmentFull[];


So why should this be undefined ? Also this code has compiled and worked before
(in my error list I see SevenSegmentFull and not SevenSegmentFul as cited above)

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 13th, 2016 at 6:37pm
Hi,

Sorry but I don't know your code or what has happened to it since it worked.

It's a standard arduino compiler error so should find solution or help in code forum.

Thanks

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 14th, 2016 at 5:53pm

Tim@Visual Micro wrote on Sep 11th, 2016 at 12:22pm:
I meant is the .h actually included in the visual studio project (right click solution explorer include/exclude)

To save us some time it might be easier if you zip and email your project folder so I can look at your setup.

Thanks



Problem with user.h not found is back in another project. I see user.h listed in the solution explorer. I have zipped and mailed it.

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 14th, 2016 at 6:17pm
Hi,

There wasn't an attachment with the email you sent.

Can you confirm the issue exists if you restart the ide?

Also please confirm the visual micro version from tools>extensions and updates

Thanks

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 14th, 2016 at 6:31pm

Tim@Visual Micro wrote on Sep 14th, 2016 at 6:17pm:
Hi,

There wasn't an attachment with the email you sent.

Can you confirm the issue exists if you restart the ide?

Also please confirm the visual micro version from tools>extensions and updates

Thanks


Mistake of me but now the attachment is mailed

same issue after I restarted the ide

have version 1609.10.0

Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 14th, 2016 at 7:11pm
Hi,

The user.h is not include in the project.

1)
I previously explained about the show all files button above the solution explorer and that it shows two different views. 1) the files on disk and 2) a filtered view of the project that shows only the files that have been included.

The word "included" has nothing to do with #include statements in the code. It relates to the standard visual studio features that allows some sources to be "included" in the build and some to be "excluded" from builds.

Right clicking files should show a standard visual micro menu with option to either "Include in project" or "exclude from project"

You didn't comment previously when I mentioned this so can we please be sure you understand what I have said and understand how to Include and Exclude files from a Visual Studio C++ project.

2)
Although it is important for your own piece of mind to clearly understand point 1) there are some safeguards for less experienced VS users that should be helping you. One would automatically include all files in the project folder into a project each time it opens. That obviously isn't working for you so please confirm the following two tools>options>visual micro settings are set to True (the default)

  • Compatibility>Compile ALL Project Folder Sources
  • Compatibility>Compile Files In Project


Thanks

Title: Re: Don't understand these compiler errors
Post by Jan Friberg on Sep 14th, 2016 at 7:53pm

Tim@Visual Micro wrote on Sep 14th, 2016 at 7:11pm:
Hi,

The user.h is not include in the project.

1)
I previously explained about the show all files button above the solution explorer and that it shows two different views. 1) the files on disk and 2) a filtered view of the project that shows only the files that have been included.

The word "included" has nothing to do with #include statements in the code. It relates to the standard visual studio features that allows some sources to be "included" in the build and some to be "excluded" from builds.

Right clicking files should show a standard visual micro menu with option to either "Include in project" or "exclude from project"

You didn't comment previously when I mentioned this so can we please be sure you understand what I have said and understand how to Include and Exclude files from a Visual Studio C++ project.

2)
Although it is important for your own piece of mind to clearly understand point 1) there are some safeguards for less experienced VS users that should be helping you. One would automatically include all files in the project folder into a project each time it opens. That obviously isn't working for you so please confirm the following two tools>options>visual micro settings are set to True (the default)

  • Compatibility>Compile ALL Project Folder Sources
  • Compatibility>Compile Files In Project


Thanks


No I'm not sure this is clear to me. Why is not the #include statement sufficient like it seem to be for all the other #include statements. According to the standard C/C++ I think it should. The two settings you mention is set to true.
After right clicking user.h and selecting include in project there are indeed no error message about user.h not existing. But instead I get this output

Compiling debug version of 'TestPrecRTCClock' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'

ccTTlKCM.ltrans0.ltrans.o*: In function main
ccTTlKCM.ltrans0.o*: (.text.startup+0x2fce): undefined reference to SevenSegmentFull
ccTTlKCM.ltrans0.o*: (.text.startup+0x2fd0): undefined reference to SevenSegmentFull
ccTTlKCM.ltrans0.o*: (.text.startup+0x3242): undefined reference to SevenSegmentFull
ccTTlKCM.ltrans0.o*: (.text.startup+0x3244): undefined reference to SevenSegmentFull

collect2.exe*: error: ld returned 1 exit status

Error compiling for board Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)


Title: Re: Don't understand these compiler errors
Post by Visual Micro on Sep 14th, 2016 at 8:21pm

Quote:
Why is not the #include statement sufficient like it seem to be for all the other #include statements. According to the standard C/C++ I think it should.


It's a good question.

Normally an, such as Eclipse and Visual Studio, ide will compile only what is included in the project.

Normally for .h files this doesn't matter so much because they don't need to be compiled, simply available as #includes.

Normally we can #include headers from anywhere such as "..\..\foo\foo.h"

BUT

For Arduino all the .ino files have to be combined into a .cpp and some extra code added. So for Arduino the build always happens in a temp folder, can't happen where the sources are actually located. This is foreign for most ide's so we are in new territory.

Consider now that if we copy the sources to a temp folder and attempt to find "..\..\foo\foo.h" it becomes a problem.

I think Visual Micro could help by automatically copying all files from the project folder to the temp folder. However things would become less consistent because if users see one file that is not "Included" in the project being found they will wonder why others can't be found.

So currently the rule is, include files in the project and they will be found and copied to the temp build folder.

I am trying to give options to move away from this constraint. You see in the last release that a project_name.cpp is supported instead of .ino files. In that case Visual Micro will use the local project folder sources in the build and the header would have been found regardless of it's inclusion in the project.

However don't rush to use a .cpp only system without understanding the following rules:-

1) A project_name.ino must still be included in the project but it can be empty and is ignored except to show which headers should be included after clicking "add library"
2) You are responsible for adding #include "arduino.h" to the project_name.cpp
3) You are responsible for creating function prototypes in the project_name.cpp or a header file.

tip: The build folder will provide a ready-made .cpp with your .ino files, prototypes etc. as an example to get going with.

As you can imagine. By removing ourselves from the .ino files and temp build folder we can start to work like a normal .cpp project however the new facility can not impact support. It is up to users to understand what is happening and to decide this is how they want to work.

Hope that helps.

Finally the error you publish is exactly the same as the error we discussed previously in this thread and the same error you get in the arduino ide. So it is a code problem.

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