0

I found my problem in issues, but I don't know how link in CLion

you need to link with -lnfc

I using gcc -o readerpnv main.c -lnfc, but honestly I don't like this way.

I try add -lnfc to build options, he wrote Unknown argument -lnfc

versions

P.S. I'm new in C, please write in more detail, thanks

  • You need to modify the `CMakeLists.txt` file that defines the executable target. There you need to add a [`target_link_libraries`](https://cmake.org/cmake/help/latest/command/target_link_libraries.html) command to list the libraries you want to link with. – Some programmer dude Aug 07 '23 at 12:57
  • @Someprogrammerdude `target_link_libraries(nfcio -lnfc)` `CMake Error at CMakeLists.txt:6 (target_link_libraries): Cannot specify link libraries for target "nfcio" which is not built by this project.` – DjamikTea Aug 07 '23 at 13:04
  • What does your `add_executable` command look like? What is the target name defined by the `add_executable` command? – Some programmer dude Aug 07 '23 at 13:09
  • I recommend you spend some time with [this CMake tutorial](https://cmake.org/cmake/help/latest/guide/tutorial/index.html), as well as [the general documentation](https://cmake.org/cmake/help/latest/index.html). – Some programmer dude Aug 07 '23 at 13:10
  • @Someprogrammerdude thank you, I add `target_link_libraries` before `add_executable` and his working – DjamikTea Aug 07 '23 at 13:15

0 Answers0