LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux Mint
User Name
Password
Linux Mint This forum is for the discussion of Linux Mint.

Notices



Reply
 
Search this Thread
Old 07-30-2010, 10:13 AM   #1
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Rep: Reputation: 15
Unhappy Help needed in compiling a programme using gcc on linux mint


Hello friends thanks for your valuable suggestions and replies, i find this community to be a very good place for gaining valuable information.

i need some help in running some basic programmes using gcc compiler on mint i don't know how to invoke gcc compiler!!!!

frnds plz help me in solving this

thank you so much
 
Old 07-30-2010, 10:20 AM   #2
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
That is too general a question.

The program you mentioned in your other theread
http://www.linuxquestions.org/questi...8/#post4050040
sounds like something you downloaded.

If you post the URL of what you downloaded, it may be easier for us to look for ourselves rather than make guesses and ask questions that you probably wouldn't know how to answer.

Most programs that are available as source (need to be compiled) have some kind of README file giving you general instructions about how to compile them.

If you can't share a URL where you got the source code, at least post a list of the files that you got, so we have some idea of your situation.

Last edited by johnsfine; 07-30-2010 at 10:22 AM.
 
Old 07-30-2010, 10:30 AM   #3
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
the thing is i am a new user of linux i started using it since 3 days and i am a basic programmer, and my requirements are i need to grab some images from an external hardware like camera and i need to open that image, all these things to done using gcc compiler and i didn't downloaded any thing from internet i juz downloaded some rpm packages from rpm site thats it....
 
Old 07-30-2010, 10:41 AM   #4
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
If you have a C program in one source file, you can compile it with gcc using a command like

gcc source_file.c -o executable

Where you replace the name source_file.c with the name of your C source file and executable with the name you want for the binary executable.

If it is a C++ program, rather than a C program, use g++ instead of gcc

All the above assumes you know how to write the program in C or C++ and just didn't know how to compile it with GCC. If you don't know how to write programs, then a program to grab images from external hardware is a difficult place to start.

You asked for help "compiling", so that is what I tried to answer. But it is hard to imagine how you might know enough to be able to write that program and not know how to compile it.

Edit: I reread your post and realized I might have ignored the important part when ignoring the following bit of nonsense

Quote:
Originally Posted by badriinvenkat View Post
i didn't downloaded any thing from internet i juz downloaded some rpm packages from rpm site thats it....
Maybe you could explain that.

Last edited by johnsfine; 07-30-2010 at 10:54 AM.
 
Old 07-30-2010, 11:02 AM   #5
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
thanks for your valuable reply

i know how to write a programme and execute it in windows, as i am working on the linux i was getting confused, i told you every thing coz u will understand my situation.

i didn't understand about the executable thing can you please explain it with an example

like i had stored a file named prav.c on my desktop and when i executed that file using this command

gcc prav.c -o executable

output is jus like this

badri@linuxmint ~/Desktop $ gcc prav.c -o executable
badri@linuxmint ~/Desktop $ gcc prav.c -o
gcc: argument to '-o' is missing
badri@linuxmint ~/Desktop $ gcc prav.c -o executable
badri@linuxmint ~/Desktop $ gcc prav.c -o executable
badri@linuxmint ~/Desktop $


where the programme contains

/* hello.c -- The most famous program of them all ..
*/

#include <stdio.h>

int main(void) {
printf("Hello World!\n");
// return 0;
}

Last edited by badriinvenkat; 07-30-2010 at 11:05 AM.
 
Old 07-30-2010, 11:27 AM   #6
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
i used rpm packages for installing gcc on my linux, one of our mate told me not to use it, dats wat i said in above quoted line
 
Old 07-30-2010, 01:05 PM   #7
johnsfine
Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,139

Rep: Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127Reputation: 1127
Quote:
Originally Posted by badriinvenkat View Post
i know how to write a programme and execute it in windows
You mean using some IDE, such as Visual Studio? Or do you understand other ways to write and execute programs?

If you only understand programming with an IDE, you should install and learn an IDE such as CODE::BLOCKS.

But Linux IDE's aren't very easy to setup and start using. I doubt anyone at LQ would have the patience to walk you through every detail. So if you try that, find a decent online tutorial for it and follow that.

CODE::BLOCKS can be very convenient to use, especially for debugging (as compared to learning how to use gdb directly) after you go to the trouble of installing it properly and learning the basics of using it.

Quote:
i didn't understand about the executable thing can you please explain it with an example
In an IDE there is one button to compile and execute a program. Without an IDE, it doesn't work that way. That is the same in Windows and Linux. There is one command to compile the program and another command to execute it.

Quote:
gcc prav.c -o executable
That compiled the program and named the result executable.

No you have a program named executable in your current directory.

To run that program type
./executable

Last edited by johnsfine; 07-30-2010 at 01:07 PM.
 
1 members found this post helpful.
Old 07-30-2010, 06:09 PM   #8
badriinvenkat
Member
 
Registered: Jul 2010
Posts: 39

Original Poster
Rep: Reputation: 15
thank you ppl so much
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Please help me in installing gcc on linux mint badriinvenkat Linux Mint 13 07-30-2010 10:05 AM
[SOLVED] Install Prolink H9601 ADSL usb modem in Ubuntu (Linux Mint 9) - Help Needed !!! ozizlk Ubuntu 2 06-23-2010 07:06 AM
Realplayer Help Needed with Firefox on Linux Mint 3.0 lawsonrc Linux - Software 1 06-18-2007 04:57 PM
while compiling c programme it's showing errors in header files mprabu20 Programming 1 04-08-2006 03:07 AM
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare Suse/Novell 3 11-29-2004 03:13 PM


All times are GMT -5. The time now is 01:37 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration