与`cc`链接失败:退出状态:1

发布于 2025-02-07 10:54:46 字数 367 浏览 1 评论 0原文

我正在使用 MultiverSX Rust Testing Framework 编写集成测试。
因此,我正在运行货物测试。但是它引发了此错误:

note: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
          (.text+0x24): undefined reference to `main'
          collect2: error: ld returned 1 exit status

我该如何修复?

I am writing integrations tests with the MultiversX Rust testing framework.
So, I am running cargo test. But it throws this error:

note: /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
          (.text+0x24): undefined reference to `main'
          collect2: error: ld returned 1 exit status

How can I fix it?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2025-02-14 10:54:46

使用这个类似的问题作为起点,我会说问题是您的问题是您的问题测试配置为Rust二进制,因此编译器期望主要功能。

尝试通过向-lib参数提供货物new new命令来重新创建您的集成测试货物包作为库。根据 <<代码>货物新

Using this similar issue as a starting point, I would say that the problem is that your tests are configured as a rust binary, and so the compiler expects a main function.

Try to re-create your integration test cargo package as a library, by providing the --lib argument to the cargo new command. Not providing that argument creates a binary by default, according to the documentation on cargo new.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文