首页 > 解决方案 > 将 GCC 链接到外部库?

问题描述

我正在尝试使用 C 中的课程模块提供的库。

我安装了以下内容:

你好ç

#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 以便可以链接到libcs​​1010.a文件?

标签: c

解决方案


推荐阅读