LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-08-2003, 08:48 PM   #1
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Rep: Reputation: 15
gcc


When I go into RH 8.0 Terminal I start off in my home folder (Of course). I then type in gcc to run the program but I get this....

gcc: No input files

Someone suggested I type it in like this...

gcc main.c -o programname

but I get the following message for that...

gcc: main.c : No such file or directory
gcc: no input files

I tried going into /usr/bin where gcc is and typed in gcc but I still get the no input file message. Please help
 
Old 03-08-2003, 08:52 PM   #2
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
gcc is a compiler. You give it a list of files of source code written in C (typically), then it crunches on them for a bit, and finally spits out an executable file. gcc, by itself, will not do anything.

Are you trying to install some software? What is it you're trying to do?
 
Old 03-08-2003, 08:56 PM   #3
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Ok well sorry I feel like an idiot but this is basically it.

I am trying to write a program in c++. What would be the best user friendly graphical interface for writing it. I thought gcc was that program, guess not

Also what is g++ in that case.
 
Old 03-08-2003, 09:06 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
No need to apologize. I've asked worse in my day, I guarantee it...

Well...... I don't know of many graphical environments like you'd see in the windows world. If you go to Freshmeat you might be able to find something.

gcc is the standard compiler for C code.
g++ is the compiler for C++ code.

So, assuming you had a source file named myprog.cpp, and wanted to test it, you'd issue a command similar to what you were suggested earlier:

g++ myprog.cpp -o my_program

That would create an executable named my_program provided there were no syntax errors or the like.

I believe vim and emacs (very popular editors) should have a way to "hook" into a c compiler. Both also have ways to colorize text based on syntax. I've never spent thte time to figure it all out though. They might do what you need, but for big programs, you'll need to read up on make and creating Makefiles.

Last edited by Dark_Helmet; 03-08-2003 at 09:40 PM.
 
Old 03-08-2003, 09:38 PM   #5
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
It just so happens there's a thread in the programming forum where someone asked if there was a good editor with syntax highlighting for C and C++. Either one of the editors mentioned there will do the trick for you out-of-the-box or one of the folks reading the thread ought to be able to help customize the editor you choose. Anyway, here's the link:

http://www.linuxquestions.org/questi...threadid=48036

I also found this on freshmeat:
Anjuta

Last edited by Dark_Helmet; 03-08-2003 at 09:43 PM.
 
Old 03-08-2003, 09:57 PM   #6
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Thanks to everyone so much for replying, its great, I will definately try out some of those things.
 
Old 03-09-2003, 12:57 AM   #7
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Well I downloaded Anjuta, its great.

I have also done my little program and have created an output I think it is of artillery.o

How do I run this file? In normal terminal I just type in artillery.o but it comes up with bash : artillery.o : command not found

How can I run programs from the terminal? (in that current folder)
 
Old 03-09-2003, 01:18 AM   #8
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Do you know what command line Ajunta used to compile the program? The reason I ask is this: g++ and gcc can output two different kinds of files. There are object files and executable files. Object files are sort of like middle-men; they aren't text source code but they aren't executables either. Look at Anjuta's options and see if you can find something along the lines of a "Compiler Command line" setting (or something similar) and post it here.

As for your problem with bash, that has something to do with your PATH environment variable. When you type a command, linux looks in a certain set of directories for the executable. Typically, the current directory is not included. So, to run a program in your current directory, you have to tell the shell explicitly. You do that by typing:
./my_program

The "./" tells it to look in the current directory.

You can try that on your file and see if it runs. If it does, then you're good to go. If not, then it's an object file like I mentioned earlier.

Last edited by Dark_Helmet; 03-09-2003 at 01:19 AM.
 
Old 03-09-2003, 01:26 AM   #9
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Thank you VERY much. It worked I finally feel like I am at least getting a little bit on top of linux (in terms of programming a little). ./ worked if you didn't guess.

Thankyou very much again I really appreciate it
 
Old 03-09-2003, 01:31 AM   #10
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
No problem. I'm glad it's working for you. Next thing you know, you'll be hacking on the kernel...
 
Old 03-09-2003, 01:33 AM   #11
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
and re-installing the os (again).

Current complete formats and re-installs stands at 3.
 
Old 03-09-2003, 01:39 AM   #12
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
It'll slow down... I did the same thing. I downloaded a bunch of distributions. Tried this, trashed that, installed another distro... repeat... repeat... you get the idea. Then you get to the point where things start making sense. Then everything is right with the world... until you discover LFS. Curiosity forces you to try, and it opens up a whole new set of challenges... interesting though...
 
Old 03-09-2003, 02:25 AM   #13
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Well to be perfectly honest I feel bad about posting this but anyway.

How can I start up with root access. I have all the passwords etc etc but I am trying to create a folder in /usr/home for mozilla, the default directory for install. It says I have to start up in root but I don't know how. I tried change root password to give me an oppotunity to type in the root password and now I have the little keys in the bottom right but I still can't make a new folder, anyone?
 
Old 03-09-2003, 03:35 AM   #14
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
From a command line, type "su -". It will then ask you for a password. Specifically, it wants root's password. When you type it in, you'll be logged in as root. Then create the directories you need with mkdir. For instance: "mkdir /usr/home/mozilla" or whatever directories you need. When you're done, type "exit" at the command line. You'll then return to being a regular user.

I don't know of any way to gain root priviledges through the file manager windows without logging on as root. I would advise against that though. It's a good idea to be only when you absolutely must be. The su command lets you become root temporarily, reducing the risk of making a catastrophic mistake from a bad command.
 
Old 03-09-2003, 03:41 AM   #15
Peleus
Member
 
Registered: Mar 2003
Posts: 77

Original Poster
Rep: Reputation: 15
Looks like I have to log in as root. This is because I type it in, create the directory and it all goes well. However the installer says when I try and install 'please choose somewhere else because you don't have permission'
 
  


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
gcc wont install, 'failed dependencies: glibc-devel is needed by gcc-3.3.3-41' TdlSnare SUSE / openSUSE 3 11-29-2004 03:13 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 12:38 PM
running software built with gcc 3.0.2 on Redhat 8 - gcc 3.2 dst1989 Linux - Software 3 03-08-2004 11:23 PM
a doubt with host gcc and arm-linux-gcc renjithgopal Linux - General 1 09-11-2003 05:02 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 01:07 AM


All times are GMT -5. The time now is 08:25 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration