编译C错误-CS50课程 - 第1周-Linux
我正在尝试通过遵循教授所做的步骤来编译一个简单的代码,但是我
cc calculator.c -o calculator
/usr/bin/ld: /tmp/ccznJMZB.o: in function `main':
calculator.c:(.text+0x19): undefined reference to `get_int'
/usr/bin/ld: calculator.c:(.text+0x2d): undefined reference to `get_int'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: calculator] Error 1
使用的是Linux Mint BTW的问题,已经在安装CS50库时遇到了问题,但这已经完成了。我很乐意收到一个新的错误,但是我需要修复它。 谢谢!
i'm trying to compile a simple code by following the steps that the professor made but I have this issue
cc calculator.c -o calculator
/usr/bin/ld: /tmp/ccznJMZB.o: in function `main':
calculator.c:(.text+0x19): undefined reference to `get_int'
/usr/bin/ld: calculator.c:(.text+0x2d): undefined reference to `get_int'
collect2: error: ld returned 1 exit status
make: *** [<builtin>: calculator] Error 1
I'm using Linux mint btw, already had problems installing cs50 library but that's done. I'm happy to get a new error tho, but I need to fix it.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
参见 https://cs50.readthedocs.io/libraries/cs50/cs50/c/
#include&lt; cs50.h&gt;
需要标题文件cs50.h
在编译器的包含路径中。#include“ cs50.h”
期望标题文件cs50.h
与您的.c .c
文件处于同一目录。上面的链接还告诉您如何安装库:
See https://cs50.readthedocs.io/libraries/cs50/c/
#include <cs50.h>
requires the header filecs50.h
to be in the include path of your compiler.#include "cs50.h"
expects the header filecs50.h
to be in the same directory as your.c
file.The link above also tells you how to install the library: