1
General Discussion about just::thread / Need on help on hardware_concurrency
« on: October 19, 2011, 03:47:34 PM »
Hi Can anyone help me with the following code snippet testing hardware_concurrency.
will@localhost:~/testspace/thread$ cat testHardware.cpp
#include <iostream>
#include <thread>
using namespace std;
int main() {
cerr << "Hardware concurrency: " << std::thread::hardware_concurrency() << endl;
return 0;
}
will@localhost:~/testspace/thread$ g++ -O2 -o hardware testHardware.cpp -I/usr/include/justthread -L/usr/lib64/ -ljustthread -pthread
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::chrono::(anonymous namespace)::get_monotonic_nanoseconds()':
chrono.cpp:(.text+0x1e): undefined reference to `clock_gettime'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::chrono::system_clock::now()':
chrono.cpp:(.text+0x5b): undefined reference to `clock_gettime'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::this_thread::__sleep_until(std::__jssZ46::chrono::time_point<std::__jssZ46::chrono::system_clock, std::__jssZ46::chrono::duration<long long, std::__jssZ46::ratio<1ll, 1000000000ll> > > const&)':
chrono.cpp:(.text+0x1bd): undefined reference to `clock_nanosleep'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::this_thread::__sleep_until(std::__jssZ46::chrono::time_point<std::__jssZ46::chrono::monotonic_clock, std::__jssZ46::chrono::duration<long long, std::__jssZ46::ratio<1ll, 1000000000ll> > > const&)':
chrono.cpp:(.text+0x220): undefined reference to `clock_nanosleep'
collect2: ld returned 1 exit status
will@localhost:~/testspace/thread$ cat testHardware.cpp
#include <iostream>
#include <thread>
using namespace std;
int main() {
cerr << "Hardware concurrency: " << std::thread::hardware_concurrency() << endl;
return 0;
}
will@localhost:~/testspace/thread$ g++ -O2 -o hardware testHardware.cpp -I/usr/include/justthread -L/usr/lib64/ -ljustthread -pthread
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::chrono::(anonymous namespace)::get_monotonic_nanoseconds()':
chrono.cpp:(.text+0x1e): undefined reference to `clock_gettime'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::chrono::system_clock::now()':
chrono.cpp:(.text+0x5b): undefined reference to `clock_gettime'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::this_thread::__sleep_until(std::__jssZ46::chrono::time_point<std::__jssZ46::chrono::system_clock, std::__jssZ46::chrono::duration<long long, std::__jssZ46::ratio<1ll, 1000000000ll> > > const&)':
chrono.cpp:(.text+0x1bd): undefined reference to `clock_nanosleep'
/usr/lib64//libjustthread.a(chrono.o): In function `std::__jssZ46::this_thread::__sleep_until(std::__jssZ46::chrono::time_point<std::__jssZ46::chrono::monotonic_clock, std::__jssZ46::chrono::duration<long long, std::__jssZ46::ratio<1ll, 1000000000ll> > > const&)':
chrono.cpp:(.text+0x220): undefined reference to `clock_nanosleep'
collect2: ld returned 1 exit status