Skip to content

On compilation: undefined reference to `clock_gettime' #2

@wimrijnders

Description

@wimrijnders

On compile, I get the following errors:

systemtime.cpp:121: undefined reference to `clock_gettime'
/tmp/ccoaIDky.o: In function `moodycamel::getTimeDelta(timespec)':
systemtime.cpp:134: undefined reference to `clock_gettime'
collect2: error: ld returned 1 exit status

This is on Ubuntu 14.04, using gcc v 4.8.1

The solution is trivial: command-line option '-lrt' should be right at the the end of the command line, not in between, eg.:

g++ -std=gnu++11 -Wall -Wconversion -fno-elide-constructors -pthread -g -O0 ../tests/common/simplethread.cpp ../tests/common/systemtime.cpp ../tests/unittests/unittests.cpp -o bin/unittests -lrt

Please adjust your makefile accordingly.

Thanks,

Wim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions