0

I am writing integrations tests with the Elrond 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, please?

Fargerik
  • 210
  • 2
  • 6

1 Answers1

1

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.

LWolf
  • 188
  • 1
  • 2
  • 7