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 std::chrono::steady_clock::now() causes linker error for STM32-C031C6 (Read 1677 times)
RichardK
Junior Member
**
Offline


Posts: 64
Joined: Jul 11th, 2023
std::chrono::steady_clock::now() causes linker error for STM32-C031C6
Sep 6th, 2023 at 10:01pm
Print Post  
If the macro 

  #define USE_NOW

is defined, I get the linker error

Compiling debug version of 'STM32-C031C6' for 'Nucleo-64 (STMicroelectronics_Nucleo_64)'
Build Folder: onics_Nucleo_64/Debug"
 
ld.exe: m-none-eabi\lib\thumb\v6-m\nofp\libc_nano.a(libc_a-gettimeofdayr.o): in function _gettimeofday_r
gettimeofdayr.c*: (.text._gettimeofday_r+0xe): undefined reference to _gettimeofday
 
collect2.exe*: error: ld returned 1 exit status

Error linking for board Nucleo-64 (STMicroelectronics_Nucleo_64)
Debug build failed for project 'STM32-C031C6'


Without this macro, the program is linked well.

Please provide complete libraries that can be linked.

Thanks
Richard

------------------------------------------------------------------

Code (C++)
Select All
#ifndef BENCHMARKTIMER_H
#define BENCHMARKTIMER_H

#  include <chrono>
#  include <string>
#  include <stdio.h>

using duration_t = std::chrono::duration<double>;

enum class Zeiteinheit_t { Sekunden, Millisekunden, Mikrosekunden };

// #define USE_NOW

class Stoppuhr // #include <chrono>
{
  std::chrono::steady_clock::time_point start;
  std::chrono::steady_clock::time_point end;

public:

  Stoppuhr() //: Zeiteinheit_t zes = Zeiteinheit_t::Sekunden) : // zes_(zes),
#ifdef USE_NOW
    : start(std::chrono::steady_clock::now())
#endif
    {};
  void Start()
  {
#ifdef USE_NOW
    start = std::chrono::steady_clock::now();
#endif
  };

  void Stop()
  {
#ifdef USE_NOW
    end = std::chrono::steady_clock::now();
#endif
  };

};
 

  

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: std::chrono::steady_clock::now() causes linker error for STM32-C031C6
Reply #1 - Sep 7th, 2023 at 11:12am
Print Post  
Can you confirm if this works as expected in the Arduino IDE?

If it does not, can you ZIP and send your project to us so we can investigate the issue more easily?
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint