./a.out fails to load

I am trying to execute a C program via gcc compiler on ubuntu 18.04

In a folder named 'gsl', I have extracted the gsl.tar file. This is also the folder where I save all my ' '.c programs written in gedit.

When to trying to execute the following via terminal,

gcc -Wall -I/Home/gsl/include -c sample.c

followed by

./a.out

I receive the following error : bash: ./a.out: No such file or directory

I quickly realized this is due to permanent deletion of a file (on my behalf) named a.out from the gsl folder.

To confirm, upon execution of the following commands :

ls -al a.out
chmod +x a.out

I get the same output :

ls: cannot access 'a.out': No such file or directory
chmod: cannot access 'a.out': No such file or directory

What action/step next will suffice to solve this issue?

How can I retrieve the a.out file (permanently deleted on my behalf)?

Thank you

Edit 1 : Removed the link for a question posted on Raspberry Pi community which I found similar to this query but is not, Thanks to @Oscar for pointing it out

12

1 Answer

This query is resolved now.

Proper linking against library was required to run the ''.c file which uses gsl libraries specifically CBLAS, executing

gcc -L/Home/gsl/lib sample.c -lgsl -lgslcblas -lm

followed by ./a.out displays the right output

A huge Thanks to @steeldriver @Oscar and @Soren A for their time and efforts in walking me step-by-step through this query. Healthy discussions indeed lead us to solutions.

Refer to : Using the gsl Library

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like