gpt4 book ai didi

c - 使用 QtCreator [mac os] 找不到 -lrt 的库

转载 作者:太空狗 更新时间:2023-10-29 16:46:11 25 4
gpt4 key购买 nike

我在使用选项“-lrt”构建的 QT 时遇到了一些麻烦

我正在使用 mac os 10.6 和 QT creator 1.2.1,heeeeeeeelp!

这是完整的构建命令:

g++ -headerpad_max_install_names -o AMiningCoreTest main.o tokenizer.o DictionnaryToolBox.o mysql.o btree.o BTreeDataTable.o tcaccess.o -L/Library/Frameworks -L/usr/lib/mysql -lmysqlclient -L/usr/local/lib/ -ltokyocabinet -lz -lbz2 -lrt -lpthread -lm -lc

结束于

ld: library not found for -lrt collect2: ld returned 1 exit status

最佳答案

链接器找不到 librt,它可能是 Posix 实时扩展库。我认为这在 OSX 上不可用。谷歌搜索给出了 Apple developer lists

列表中的问题

I'm trying to build a simulator developed in my university (on Linux) and I get error by the linker that seems unable to find librt.a - in the code is used for clock_gettime() and I would like to know if there's a port of such library, or some other similar function that allows me to compile even on Mac OS X.

Answer librt.a is the System V name of the library containing the POSIX Advanced Realtime [RT} Option functions. The specific function you are asking about is part of the [TMR] option. If Mac OS X supported it, it would be in libSystem.B,dylib, not librt.a. The function in question is not supported by Mac OS X.

Your code should check to see whether optional to implement things above and beyond the UNIX standard are implemented in the target OS, and if they aren't, use a different interface.

关于c - 使用 QtCreator [mac os] 找不到 -lrt 的库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1505402/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com