c++ - #include <lib.h> 找不到符号,为什么?

标签 c++ xcode

我有这个代码:

#include <iostream>
#include <mp4.h>

int main (int argc, char * const argv[]) {
    // insert code here...
    std::cout << "Hello, World!\n";

    MP4Read("filename", MP4_DETAILS_ALL );

    return 0;
}

并且我已经将 -I/opt/local/include 和 -L/opt/local/lib 添加到路径(通过 macports 安装后 mp4 库所在的位置),但我得到的只是:

Undefined symbols: "_MP4Read", referenced from: _main in main.o ld: symbol(s) not found

即使 XCode 找到它并正确自动完成...

最佳答案

您最有可能需要链接库,即添加 -lmp4 或类似链接命令。

关于c++ - #include <lib.h> 找不到符号,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/667015/

相关文章:

c++ - 我什么时候会在基类中默认(而不是删除)复制和移动操作

Xcode 10.3 不适用于 MacOS Big Sur 11.0.1(非测试版)

iphone - CollectionView类View,可水平+垂直滚动

ios - Xcode 控制台中我的应用程序名称旁边括号中的数字是什么意思?

c++ - 如何从 C++ 中的字符串中提取子字符串?

c++ - SFINAE : Derived class hide base class function depend on T

c++ - 在初始化列表中使用#define

c++ - 这个基本 MFC 对话框应用程序的入口点是什么?

ios - "Linker command failed with exit code 1 (use -v to see invocation)?"如何解决

ios - NSLog 在哪里定义,即。 NSLog 的标题是什么?