与`cc`链接失败:退出状态:1
我正在使用 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用这个类似的问题作为起点,我会说问题是您的问题是您的问题测试配置为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 thecargo new
command. Not providing that argument creates a binary by default, according to the documentation oncargo new
.