About Us Knowledge Base Community Forum Electronics Toolbox FAQ Shipping & Delivery

Community Forum

Share your projects and post your questions

Search
Register or Sign In
Forum

Errors Running C Code Libraries

76 Views - Created 16 days ago

16 days ago

Posted by:
Andr22

Users 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

16 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

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.

AB Electronics UK Tech Support

16 days ago

Posted by:
Andr22

Users 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

16 days ago

Posted by:
andrew

Users Avatar

Location:
United Kingdom

Users Twitter  Users Website  

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

 

AB Electronics UK Tech Support

16 days ago

Posted by:
Andr22

Users Avatar

That seems to have fixed it now thanks

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.