函数"Undefined symbol"错误

"Undefined symbol" errors on functions

本文关键字:错误 symbol Undefined 函数      更新时间:2023-10-16

我正在尝试让 https://github.com/Duthomhas/CSPRNG 的库工作。

这是我的代码:

#include <iostream>
#include <duthomhas/csprng.hpp>
int main(int argc, const char * argv[]) {
duthomhas::csprng rng;
return 0;
}

当我编译它时,我得到两个错误:"未定义的符号:_csprng_create"和"未定义的符号:_csprng_destroy"。这对我来说没有意义,因为包含在csprng.hpp中的csprng.h文件定义了函数csprng_create()和csprng_destroy()。那么为什么编译器不承认这些函数的存在呢?我该如何解决这个问题?

头文件不包含函数的实现,仅包含定义。包中有一个 cpp 文件,其中包含这些实现,我现在已包含,现在程序编译得很好。

相关文章: