【发布时间】:2021-12-28 06:33:24
【问题描述】:
您好,我正在尝试链接到没有标题的库。我完全按照库中的定义编写了原型,但 ld 无法链接它。
readelf -Ws 发布/libcef.so | grep KeyStringToDomKey
386822: 00000000066d73d0 328 FUNC LOCAL HIDDEN 17 _ZN2ui16KeycodeConverter17KeyStringToDomKeyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
readelf -Ws main-6cf4e2.o | grep KeyStringToDomKey
13: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND _ZN2ui16KeycodeConverter17KeyStringToDomKeyERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE
#include <iostream>
#include <string>
#include "domkey.h"
namespace ui {
class KeycodeConverter {
public:
static DomKey KeyStringToDomKey(const std::string&);
};
}
using namespace std;
int main()
{
auto t = ui::KeycodeConverter::KeyStringToDomKey("t");
cout << "Hello World!" << endl;
return 0;
}
【问题讨论】:
-
链接到没有标题的库你是什么意思?