JetsonGPIO: Trying to run `button_event.cpp` gives error `undefined reference to 'main'` and deletes the file.

$ g++ -o button_event.cpp -lJetsonGPIO -lpthread -I/usr/local/include/Jetso>
/usr/lib/gcc/aarch64-linux-gnu/7/../../../aarch64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
(.text+0x1c): undefined reference to `main'
collect2: error: ld returned 1 exit status
$ dir
button_interrupt.cpp  simple_out.cpp  simple_pwm.cpp  test_all_apis.cpp

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 28 (15 by maintainers)

Most upvoted comments

  1. for a quick temporary test:
    try export LD_LIBRARY_PATH=/usr/local/lib/ And run the program again.

  2. Can you share the result

cat /etc/ld.so.conf

and

cat /etc/ld.so.conf.d/libc.conf