sijpesteijn / BBCLib

C Library for BeagleBone Black
GNU General Public License v2.0
16 stars 47 forks source link

compilation error problem #3

Open manibenwa opened 6 years ago

manibenwa commented 6 years ago

Hai ,

i downloaded BBCLib library from this github and iam trying to compile the program ,it gives me following error

/usr/lib/gcc/arm-linux-gnueabihf/4.9/../../../arm-linux-gnueabihf/crt1.o: In function _start': (.text+0x28): undefined reference tomain' /tmp/ccJqpvUX.o: In function uartExample': uart_example.c:(.text+0x12): undefined reference toinit_bbc_lib' uart_example.c:(.text+0x36): undefined reference to uart_open' uart_example.c:(.text+0x80): undefined reference touart_send' uart_example.c:(.text+0xb2): undefined reference to uart_read' uart_example.c:(.text+0xf8): undefined reference touart_close' collect2: error: ld returned 1 exit status

can u please tell me is there any thing need to attache while compiling the program???

danboatman commented 5 years ago

were you able to solve this issue? I am having the same problem.

mishaturnbull commented 5 years ago

Can verify we're also having the same issue here. Any fixes? My exact error is slightly different:

debian@beaglebone:~/[redacted]/BBCLib/examples/leds$ gcc onboardleds.c -o leds
/usr/lib/gcc/arm-linux-gnueabihf/6/../../../arm-linux-gnueabihf/Scrt1.o: In function `_start':
(.text+0x44): undefined reference to `main'
/tmp/ccH15oHX.o: In function `onBoardLedsExample':
onboardleds.c:(.text+0x8b2): undefined reference to `debug'
collect2: error: ld returned 1 exit status

I don't believe it makes any difference, but the hardware being used is the SanCloud BeagleBone Enhanced, which is based on the Black with some modifications and extra sensors.

mishaturnbull commented 5 years ago

Update @manibenwa @danboatman, I think I've made some headway here.

I was trying to compile purely the onboardleds.c file (which includes its associated header onboardleds.h). That file does not have a main method, resulting in the error that we get. Note that in pbr.sh, the actual executable is BBCLib living in the root directory and is compiled from examples/example.c. That file has a main method, and includes the methods that actually do something from the example files that I (we?) were trying to compile (the ones like examples/leds/onboardleds.c).

It seems like the example files here are not to be run on their own, but rather #included and used that way.