Gcc issues


#1

Hey guys, thanks for such a great product! It’s just our first day, but my son and I are loving it. So far, I have Python and Scratch working well (with simplebot at least), but can’t see to get gcc to compile properly. No matter how I try running the command line, I get the error:

/tmp/cc9tITUv.o: In function BrickPiRx': simplebot_simple.c:(.text+0x1bc0): undefined reference toCurrentTickUs’
simplebot_simple.c:(.text+0x1bdc): undefined reference to CurrentTickUs' /tmp/cc9tITUv.o: In functionmain’:
simplebot_simple.c:(.text+0x1fb8): undefined reference to `ClearTick’
collect2: ld returned 1 exit status

Which leads me to think that it’s not finding tick.h properly, but even if it’s in the current directory, or /usr/local/include, I still get the message. Any ideas at what the problem could be?

Thanks!


#2

What command are you using to compile it?

I agree it likely isn’t linking in tick.h for some reason.


#3

The error happens with various commands, for example:

gcc -o program program.c -lrt -lm -L/usr/local/lib -lwiringPi

(and variations on the above)

I’ve tried copying the .h files into /usr/include but that didn’t seem to do anything.


#4

I had the same issue. In my caseI had downloaded the BrickPi_C folder to the desktop. I found that I could include the tick.h file using a compiler command like
gcc -o program sourcefile.c -lrt -lm -L/usr/local/lib -lwiringPi -I /home/pi/Desktop/BrickPi_C/Drivers

The important bit was adding the -I /home/pi/Desktop/BrickPi_C/Drivers
which enabled the files to be found. Hope this helps