LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   trying to get c to run on ubuntu. (https://www.linuxquestions.org/questions/linux-newbie-8/trying-to-get-c-to-run-on-ubuntu-789150/)

contentprovider 02-15-2010 12:04 AM

trying to get c to run on ubuntu.
 
i have an example c program.. which I have loaded with my text editor..
into my documents on ubuntu.. each time I try to run it, I get the message command not found.. must i make it first, or is it a path problem. ?

jstephens84 02-15-2010 12:09 AM

cd into the path that the c program lies in. Then try
Code:

./<your app name>
this should run the application using relative path reference.

smeezekitty 02-15-2010 12:42 AM

Code:

export PATH=.:$PATH
then try it again.

knudfl 02-15-2010 03:17 AM

Quote:

I have an example c program..
which I have loaded with my text editor..
A text file "c program" cannot be run.

Example : example.c → you will have to compile it.
gcc example.c -o example

Use it : 1) cd <path-to-folder-with-example>/example
2) ./example

Or : # cp example /usr/local/bin/
.. Then it is in your PATH.
.....

halborr 02-15-2010 09:22 AM

Quote:

Originally Posted by knudfl (Post 3864057)
A text file "c program" cannot be run.

Example : example.c → you will have to compile it.
gcc example.c -o example

Use it : 1) cd <path-to-folder-with-example>/example
2) ./example

Or : # cp example /usr/local/bin/
.. Then it is in your PATH.
.....

You might have to "chmod +x example" to execute it. ("ls -l" lists current permissions).


All times are GMT -5. The time now is 10:47 AM.