Bonjour
Pour faire un test de benchmark j'ai pensé utiliser boost::chrono::process_user_cpu_clock.
J'ai la dernière version de boost mais apparemment cela ne suffit pas. Voici un petit programme qui ne compile plus si on décommente le block.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <iostream>
#include <boost/chrono/include.hpp>
 
using namespace std;
using namespace boost;
using namespace boost::chrono;
 
 
int main()
{
    cout << "Hello world!" << endl;
 
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
  cout<<"\n YES 1";
#endif
 
#ifdef BOOST_CHRONO_HAS_PROCESS_CLOCKS
  cout<<"\n YES 2";
#endif
 
#ifdef BOOST_CHRONO_HAS_THREAD_CLOCK
 cout<<"\n YES 3";
#endif
 
/*
std::cout << system_clock::now() << '\n';
 
#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY
  std::cout << steady_clock::now() << '\n';
#endif
 
std::cout << high_resolution_clock::now() << '\n';
 
#ifdef BOOST_CHRONO_HAS_PROCESS_CLOCKS
  std::cout << process_real_cpu_clock::now() << '\n';
  std::cout << process_user_cpu_clock::now() << '\n';
  std::cout << process_system_cpu_clock::now() << '\n';
  std::cout << process_cpu_clock::now() << '\n';
#endif
 
#ifdef BOOST_CHRONO_HAS_THREAD_CLOCK
  std::cout << thread_clock::now() << '\n';
#endif
 
*/
    return 0;
}
J'ai droit au message d'erreur
... undefined reference to `boost::chrono::system_clock::now()'
Idem pour les autres.

Il faut sans doute faire quelque chose en plus mais quoi ? Merci d'avance pour vos réponses.

PS : je sais qu'il y a un forum spécial pour boost mais la dernière question date du 08/07/2024 et est restée sans réponse depuis. En outre le fil [Actualité] date de ... 2012 !
Ne m'en veuillez pas de poser ma question ici.