c - 将 GCC 链接到外部库?
问题描述
我正在尝试使用 C 中的课程模块提供的库。
我安装了以下内容:
- MinGW32 - 基础
- 视觉代码
你好ç
#include <stdio.h>
#include "libcs1010/include/cs1010.h"
int main()
{
// library method
cs1010_print_double(10);
printf("Hello, World!");
return 0;
}
错误
undefined reference to `cs1010_print_double'
collect2.exe: error: ld returned 1 exit status
目录结构:
└───hello.c
└───libcs1010
├───include
| └───cs1010.h
├───lib
| └───libcs1010.a
└───src
└───cs1010.c
如何运行 GCC 以便可以链接到libcs1010.a文件?
解决方案
推荐阅读
- c# - Winform:允许用户动态更改应用程序的颜色
- javascript - ExpressJS 在记录 req.cookies 时返回空对象
- python - 如何仅提取音频文件中的语音/语音?
- javascript - 如何使用 discord.js 更改个人资料图片和服务器名称
- matlab - 使用 J. Wu 的快速线性插值法在 Matlab 中进行图像插值
- python-3.x - 如何在python中处理未知大小的数值的多值行?
- c++ - 错误:lib.a:重定位 R_X86_64_PC32 对符号“...”在制作共享对象时不能使用;使用 -fPIC 重新编译
- matlab - 如何在不使用“find”“min”等内置函数的情况下找到向量 A 的最小值并索引所有最小值并召回重复项?
- ansible - 如何知道 ansible 中 ovirt_* 模块的nested_attributes 名称?如何全部获取?
- javascript - FlatList 不渲染来自 json 数组 React-native 的数据