LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-15-2005, 12:16 AM   #1
mili
LQ Newbie
 
Registered: Apr 2005
Posts: 19

Rep: Reputation: 0
Making executabe files


Hai friends

i have developed an application in c language. Now I want to make an executable file for that.
I don't know how to do....so please help me
 
Old 06-15-2005, 12:40 AM   #2
hardcorelinux
Member
 
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31
http://www.linuxquestions.org/questi...2001/10/2/7011
 
Old 06-15-2005, 01:22 AM   #3
mili
LQ Newbie
 
Registered: Apr 2005
Posts: 19

Original Poster
Rep: Reputation: 0
i don't want to make .exe file. i want to execute my program
using its name.. like vi..
my program name is 'lncur' . i want to run my program using command
lncur. is there any way to do this
 
Old 06-15-2005, 01:24 AM   #4
lowpingnoob
Member
 
Registered: Jun 2005
Distribution: Fedora Core 3, soon DSL (DSL backwards is LSD hahahaha)
Posts: 245

Rep: Reputation: 30
Quote:
Originally posted by mili
i don't want to make .exe file. i want to execute my program
using its name.. like vi..
my program name is 'lncur' . i want to run my program using command
lncur. is there any way to do this
 
Old 06-15-2005, 01:35 AM   #5
hardcorelinux
Member
 
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31
chmod 755 lncur

./lncur
 
Old 06-15-2005, 01:51 AM   #6
mili
LQ Newbie
 
Registered: Apr 2005
Posts: 19

Original Poster
Rep: Reputation: 0
i want to use only' lncur' as a command.is there any way
 
Old 06-15-2005, 02:12 AM   #7
zackarya
Member
 
Registered: Jul 2003
Distribution: OpenSuse 10, Debian
Posts: 152

Rep: Reputation: 30
Assuming your using gcc and it's a single file the command would be

gcc -Wall -o whatyouwanttonamethefile thenthesourcefile.c

-Wall gives you very verbose compiling. You should always use it.
-o tells the compiler the name you want to call your file

So for example with Incur as the name I want to execute and Incur.c as the
name of the file to compile I would do

gcc -Wall -o Incur Incur.c

Hope that helps.

Zack
 
Old 06-15-2005, 02:40 AM   #8
mili
LQ Newbie
 
Registered: Apr 2005
Posts: 19

Original Poster
Rep: Reputation: 0
in this case also i have to give ./lncur
i want to use only 'lncur' to run
 
Old 06-15-2005, 06:34 AM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,704

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
linux only searches for a command using the path environment. Since the directory where lncur is located is not in your path then with out the ./ you will see a command not found error. BTW ./ is a shortcut for current working directory.

To see your current path environment use the following command:
echo $PATH

You can add a directory to your users path environment via your /.bash_profile file like:
PATH=$PATH:/data/myprogram

To add the path for all users add the directory to the /etc/profile file.

Of course you can always move the executable to a directory that is already in the path.

Last edited by michaelk; 06-15-2005 at 06:35 AM.
 
Old 06-15-2005, 06:59 AM   #10
pokemaster
Member
 
Registered: Apr 2005
Location: Massachusetts, USA
Distribution: debian,ubuntu,slackware
Posts: 110

Rep: Reputation: 17
Hmm -- tough question... it depends how it was developed. You might have to do a
Code:
qmake
make
or perhaps
Code:
gcc main.c
maybe just
Code:
make
Did you write the app for qt? gnome? using an application editor? or is it a text-based proggy from emacs? do you have makefiles? and the list goes on, unfortunately. Let us know how you wrote the program, and what files are involved, then we can give you something to go on...
 
Old 06-15-2005, 07:04 AM   #11
pokemaster
Member
 
Registered: Apr 2005
Location: Massachusetts, USA
Distribution: debian,ubuntu,slackware
Posts: 110

Rep: Reputation: 17
sorry, i got a bit ahead of myself there -- i thought you were looking for compiling info.

All you have to do is go into one of the bin directories (me, i prefer /usr/local/bin), be root, and type
[code]
ln -s *path to your program* /usr/local/bin/lncur
[code]

This should do what you want...
 
Old 06-16-2005, 01:32 AM   #12
mili
LQ Newbie
 
Registered: Apr 2005
Posts: 19

Original Poster
Rep: Reputation: 0
thank you sir ..it works....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DDD Cannot recognize executabe jonty_11 Programming 4 05-08-2012 09:13 PM
making .tif files into animated .gif files (bash shell, Red Hat 7.2) illiniguy3043 Linux - Newbie 1 06-01-2004 04:04 PM
making a .deb from source files h/w Debian 2 01-05-2004 04:54 PM
binary executabe? ksd Linux - Software 8 10-19-2003 07:13 AM
making pdf files mdfarez Linux - Software 2 01-07-2003 11:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration