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) Error compiling time.h libray (Read 14639 times)
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Error compiling time.h libray
Dec 22nd, 2015 at 9:12am
Print Post  
I am triing to compile a sketch that call time.h library ( downloaded from https://github.com/PaulStoffregen/Time

During compilation new files ( time.cpp.o and time.cpp.d ) are created and then it give error because the functions  have a multiple definition :
in the original time.cpp and in the created time.cpp.o! Sad

I never saw a similar error using Arduino IDE!

Why new new files are created?
What I can do to fix this error?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #1 - Dec 22nd, 2015 at 1:53pm
Print Post  
Hi,

Which includes do you have in your .ino file?

What does this mean?
original time.cpp and in the created time.cpp.o! 

Please zip and post or email your project so I can see your code. (email info@visualmicro.com)

Thanks
« Last Edit: Dec 22nd, 2015 at 1:54pm by Tim@Visual Micro »  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #2 - Dec 23rd, 2015 at 8:12am
Print Post  
Thank for your reply!
The compilation source is quite large!

I will start with a copy of the error printout:
Compiling debug version of 'interval_program_v2' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'
Time.cpp.o:In function `breakTime(unsigned long, tmElements_t&)
Time.cpp:multiple definition of `breakTime(unsigned long, tmElements_t&)
Time.cpp.o:d:\users\pbecc\onedrive\Arduino\libraries\Time\Time.cpp:151: first defined here
ld.exe:Disabling relaxation: it will not work with multiple definitions
Time.cpp.o:In function `breakTime(unsigned long, tmElements_t&)
Time.cpp.o:In function `breakTime(unsigned long, tmElements_t&)
Time.cpp:multiple definition of `setSyncInterval(unsigned long)
Time.cpp.o:d:\users\pbecc\onedrive\Arduino\libraries\Time\Time.cpp:151: first defined here
collect2.exe*:error: ld returned 1 exit status
Error creating .elf

In addition after compilation I have to manually delete files time.cpp.o and time.cpp.d from library folder.

Running library example Time Serial give following error:

Compiling debug version of 'TimeSerial' for 'Arduino/Genuino Mega w/ ATmega2560 (Mega 2560)'
TimeSerial.ino:9:1: error: 'time_t' does not name a type
:time_t requestSync()
TimeSerial.ino:In function 'void setup()
TimeSerial.ino:22:18: error: 'requestSync' was not declared in this scope
:setSyncProvider( requestSync)

Both compilation run on IDE 1.6.5. and a older version of time.h library don't give these errors!

I am lost!
« Last Edit: Dec 23rd, 2015 at 2:46pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #3 - Dec 23rd, 2015 at 12:19pm
Print Post  
Please post links old and new versions of the lib if you can and ensure you have the latest release of visual micro
  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #4 - Dec 23rd, 2015 at 1:05pm
Print Post  
The link for the new  library is: github.com/PaulStroffegen/time 

The old library can be found here: 
https://github.com/Dave1001/OpenSprinkler-Arduino/tree/master/OpenSprinkler_Ardu...

I have installed Visual Studio and Visual Micro only few days ago!

Thanks for your help!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #5 - Dec 23rd, 2015 at 2:54pm
Print Post  
Hi,

I just tried the new library and it compiled okay for me.

So I guess this means we are finding some additional files that cause confusion in your project or in the library list. This shouldn't happen in normal circumstances.

Please switch on "tools>options>visual micro>compiler>show build properties" and switch on "verbose"

Then click "Build>clean" and then "Build"

Please post or email the output to info[at]visualmicro.com

Thanks
  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #6 - Dec 23rd, 2015 at 4:53pm
Print Post  
This is what I get with verbose=true:
file .txt attached

Thanks!
  

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #7 - Dec 23rd, 2015 at 6:15pm
Print Post  
I have had another look at your build output and worked out what the problem is.

You have added a shortcut to the Time library into your arduino project. That is going to cause the errors you see.

The same code can't be a library and source code in the current project. 

If you want to view arduino library sources while developing then switch on "Project>Show Arduino Core and Library Sources". This will add shortcuts to the project under a folder that is automatically created called "_Libraries". These sources will not be compiled

Please right click the library sources in the Visual Studio solution explorer, then click "Remove"

If you are new to Arduino, I should also explain that you do not need to add sources to the project to use Arduino libraries. The build system automatically determines the libraries to be used from the #includes in the sketch.ino

Thanks

ps: I see that in this situation visual micro does create the compiler temp files in the lib folder. That will be resolved in the next release but won't cause an issue.
« Last Edit: Dec 23rd, 2015 at 8:00pm by Tim@Visual Micro »  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #8 - Dec 24th, 2015 at 10:05am
Print Post  
Thank you so much! Smiley
I removed the library source from the explorer and ... compilation was OK!!
Simple.....now that I know!

Thanks again......
...but I need another little help: Embarrassed

I need to compile the library also for a different board: NodeMCU ESP8266.

I am using the library example "TimeNPT_ESP8266WiFi"
The compilation work well using   IDE 1.6.5
but with VisualMicro give :

f-gcc\1.20.0-26-gb404fb9-2/bin/xtensa-lx106-elf-gcc" -D__ets__ -DICACHE_FLASH -U__STRICT_ANSI__ 0.0-rc2/tools/sdk/include" -c -Os -g -Wpointer-arith -Wno-implicit-function-declaration -Wl,-EL -fno-inline-functions -nostdlib -mlongcalls -mtext-section-literals -falign-functions=4 -MMD -std=gnu99 -ffunction-sections -fdata-sections -DF_CPU=80000000L -DARDUINO=165 -DARDUINO_ESP8266_ESP12 -DARDUINO_ARCH_ESP8266 -DESP8266 -I"D:\Users\pbecc\OneDrive\Arduino\libraries\Time\examples\TimeNTP_ESP8266WiFi" 0.0-rc2\cores\esp8266" 0.0-rc2\variants\nodemcu" 0.0-rc2\libraries\ESP8266WiFi\src" -I"d:\users\pbecc\onedrive\Arduino\libraries\Time" -I"D:\Program Files\VisualStudio\Common7\IDE\Extensions\lvqhzc5c.5em\Micro Platforms\default\debuggers\VM_DBG" -I"d:\Program Files\Arduino\libraries" 0.0-rc2\libraries" -I"D:\Program Files\VisualStudio\Common7\IDE\Extensions\lvqhzc5c.5em\Micro Platforms\default\debuggers" -I"d:\users\pbecc\onedrive\Arduino\libraries" 0-rc2\cores\esp8266\time.c" -o v2\time.c.o" -DVM_DEBUG -DVM_DEBUG_ENABLE=1 -DVM_DEBUG_BANDWIDTH_THROTTLE_MS=100 -DVM_DEBUGGER_TYPE_HARDWARESERIAL=0 -DVM_DEBUGGER_TYPE_SOFTWARESERIAL=1 -DVM_DEBUGGER_TYPE_FASTSERIAL=2 -DVM_DEBUGGER_TYPE_USB=3 -DVM_DEBUGGER_TYPE_TEENSY=4 -DVM_DEBUGGER_TYPE_UART=5 -DVM_DEBUGGER_TYPE_USART=6 -DVM_DEBUGGER_TYPE_USBSERIAL=7 -DVM_DEBUGGER_TYPE_TTYUART=8 -DVM_DEBUGGER_TYPE_NET_CONSOLE=9 -DVM_DEBUGGER_TYPE_Uart=10 -DVM_DEBUGGER_TYPE_COSA=11 -DVM_DEBUGGER_TYPE=VM_DEBUGGER_TYPE_HARDWARESERIAL
os_type.h:In file included from
sntp.h:from
time.c:from
ets_sys.h:148:20: error: unknown type name 'size_t

Error compiling core
« Last Edit: Dec 24th, 2015 at 6:49pm by Tim@Visual Micro »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #9 - Dec 24th, 2015 at 6:52pm
Print Post  
Hi,

I just tried that example and it compiles okay for me however there are some differences between our configs.

I am going to assume you opened the example and did not add anything to the project? Just got the .ino in it? This means we have the same test.

The board core you have installed looks different because my core has two NodeMcu boards. NodeMcu 1.0 and 0.9

The board support url I am using for esp8266 is http://arduino.esp8266.com/staging/package_esp8266com_index.json

What is the url that you have used for the Arduino Ide Board Manager?
  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #10 - Dec 25th, 2015 at 8:45am
Print Post  
Hello and....

Merry Christmas!

We have identical configuration :

-I use same board url
-I also have available two MCU board 0.9 and 1.0.
-I have opened the example ino and nothing else from the example directory.

The only possible difference is that my IDE  1.6.5 and ESP board support  (using IDE board manager) were already installed at the time I have installed Visual Micro.

Thanks again!
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #11 - Dec 28th, 2015 at 9:16pm
Print Post  
Hi,

Merry christmas to you too.

I think I need to see a full build output from both the arduino ide and visual micro

Arduino Ide>File>Preferences>Verbose

then build

And one from visual micro but after clicking "build>clean solution" and then click "Build"

email to info[at]visualmicro.com or attach to a post

Thanks
  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #12 - Dec 29th, 2015 at 8:17am
Print Post  
Hello again,

Here attached the two verbose output you were asking! 

thanks!

Paolo
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #13 - Dec 29th, 2015 at 8:18am
Print Post  
May be ..........only one attachment per post!
  

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


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Error compiling time.h libray
Reply #14 - Dec 29th, 2015 at 10:57pm
Print Post  
Thanks for the info.

I think the problem was a bug which I hope was fixed in the last couple of releases. 

The library paths were passed as include during compilation of the esp core. The esp core has a time.h and I expect that gets confused with the time library.

Please update to the latest version of visual micro and see if that fixes it.

Thanks
  
Back to top
IP Logged
 
paolo48
Junior Member
**
Offline


Posts: 69
Joined: Dec 22nd, 2015
Re: Error compiling time.h libray
Reply #15 - Dec 30th, 2015 at 11:09am
Print Post  
Perfect!! Smiley
Very timely update!

Thank you so much!

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint