Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Errors Running C Code Libraries

The ADC-DAC Pi Zero is a 2 Channel ADC and 2 Channel DAC for the Raspberry Pi

09/02/2021

Posted by:
Andr22

Andr22 Avatar

My Raspberry Pi 4 B is running Raspberry Pi OS. I am trying to compile and run ABE_ADCDACPi.c.



However, I keep getting all sorts of various errors. I believe I am correct in compiling it by using -nostartfiles as the .c and .h files do not use the make function commonly found in C programs. This appears to work and creates a file called a.out, however I can't run it. If someone could explain to me clearly how to compile and execute this code I would be extremely grateful. I am a total beginner when it comes to this, I just need to run this code for a project I am working on. Thanks

09/02/2021

Posted by:
andrew

andrew Avatar

Hello

Can you try compiling the demo-adcread.c program in the same directory as the ABE_ADCDACPi.c file?

Use the command "gcc ABE_ADCDACPi.c demo-adcread.c -o demo-adcread" to create an executable file called demo-adcread

If the demo file compiles and runs then it is probably the -nostartfiles parameter that is causing the problems with your program.

09/02/2021

Posted by:
Andr22

Andr22 Avatar

Quote from andrew
Hello Can you try compiling the demo-adcread.c program in the same directory as the ABE_ADCDACPi.c file? Use the command "gcc ABE_ADCDACPi.c demo-adcread.c -o demo-adcread" to create an executable file called demo-adcread If the demo file compiles and runs then it is probably the -nostartfiles parameter that is causing the problems with your program.

After attempting this I get a huge list of errors saying "error: stray '\1' in the program" etc

09/02/2021

Posted by:
andrew

andrew Avatar

It looks like the program files have somehow picked up some stray characters which are causing the compiler to fail.

Can you try cloning a new copy of our GitHub repository onto your Raspberry Pi using the command below and see if that has the same issues?


git clone https://github.com/abelectronicsuk/ABElectronics_C_Libraries.git

09/02/2021

Posted by:
Andr22

Andr22 Avatar

That seems to have fixed it now thanks

Sign in to post your reply


Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view.
Download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.

Home

Shop

Learn

Forum

FAQ

Contact

0 item

Your cart is empty

Please browse our shop to order from the wide range of Raspberry Pi boards and accessories.

Subtotal:£0.00
View Basket Continue to Checkout