LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-10-2001, 03:43 AM   #1
neko
LQ Newbie
 
Registered: Jul 2001
Posts: 3

Rep: Reputation: 0
Question gcc-g77 package


Hy, I recently installed the Mandrake 8.0 distribution and I have some problems with the fortran compiler (package gcc-g77). I can compile the programs but not execute them. For example, an executable toto is created but when I try toto, the error message "command toto not found" appears. Does someone have an idea about my problem ?

Thanks a lot.
 
Old 07-10-2001, 03:59 AM   #2
cinnix
Member
 
Registered: Jun 2001
Location: Northern Ohio
Distribution: RedHat, Engarde and LFS
Posts: 237

Rep: Reputation: 30
make sure you have execute permissions set and if the program is not in your path you have to execute the program like this

./toto

To check your path do a

echo $PATH
 
Old 07-11-2001, 02:00 AM   #3
neko
LQ Newbie
 
Registered: Jul 2001
Posts: 3

Original Poster
Rep: Reputation: 0
Thumbs up About PATH...

It did work when I tried ./toto but what does it mean ?
I am a Linux beginner and I am not familiar with these questions of PATH. Should I change something in my directories ?
 
Old 07-11-2001, 03:50 AM   #4
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
You've used DOS yeah? If you type 'format' in DOS, and format.com is in your current (working) directory then that program will be executed, if its not they command.com looks in all the dirs in your path. On linux if you had the program 'fdformat' in the current directory and you type 'fdformat' then unless your path contains ./ (the current dir) then the 'fdformat' in the current directory won't be executed, your shell will instead look in all the directories in your path. Hence if you have a program in the current directory called 'toto' then just typing 'toto' will fail, you need to type './toto' to reference the toto program in the current directory.

That make sense??

Jamie...
 
Old 07-11-2001, 03:56 AM   #5
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
PATH is an enviromental variable... when you call a prog to be executed, the computer will check in each directory listed in the PATH variable for the program. that way, you can call certain programs from any directory.

on linux, like in DOS, "cd .." will take you one directory lower. this is because the ".." represents the directory below the current one. whereas just "." represents the current one. if you call a program in linux, it will only execute if
1: you give the full name, path included, such as /usr/bin/clock
2: the program is in one of the directories listed in PATH

the trick to the ./ is that "." represents the current directory, and linux will fill in the "." with the current directory. let's say you make a program in the /usr/src/packages directory. the full name of the program will be /usr/src/packages/prog1
so, you type ./prog1, and linux translates it to /usr/src/packages/prog1 automagically.

your directories are probably fine. it's the PATH variable that you need probably need to change. do you happen to know what shell you're running?

Last edited by isajera; 07-11-2001 at 04:05 AM.
 
Old 07-11-2001, 04:00 AM   #6
jharris
Senior Member
 
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243

Rep: Reputation: 47
No matter how you address a file it isn't going to execute unless its executable flag is set! Wether you address it as ./someFile or /someDir/someFile or anyother how.

cheers

Jamie...
 
Old 07-11-2001, 04:08 AM   #7
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
sorry about that jamie... i edited the massively erroneous parts of that last post... <- you know, you really need a smiley for extreme embarrasment.
 
Old 07-16-2001, 03:00 AM   #8
neko
LQ Newbie
 
Registered: Jul 2001
Posts: 3

Original Poster
Rep: Reputation: 0
Lightbulb Thanks

Thanks a lot to you... I begin to understand better the role of the PATH.
 
Old 07-20-2001, 06:39 PM   #9
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Rep: Reputation: 30
I to am a newbie in programming

I am doin' the imfamous hello.cxx, After writing the code in my text editor...I did the compile, gcc hello.xx -o hello.......I got this return:
/tmp/ccTCzq9c.o: In function 'main':
/tmp/ccTCzq9c.o(.text+0xf): undefined reference to 'cout'
/tmp/ccTCzq9c.o(.text+0xf14): undefined reference to 'ostream:perator<<(char const *)'
collect2: ld returned 1 exit status

Does anybody know what the hell this means???
 
Old 07-21-2001, 01:14 AM   #10
isajera
Senior Member
 
Registered: Jun 2001
Posts: 1,635

Rep: Reputation: 45
the compiler isn't recognizing the file as c++... it's treating it as a c file. i remember i once solved that prob by just renaming the file to hello.C instead of hello.c.

it still boggles my mind that it worked, and i wouldn't dispense it as advice if it hadn't really happened.
 
Old 07-21-2001, 04:35 AM   #11
trusouthrnplaya
Member
 
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223

Rep: Reputation: 30
I tried that....and still got the same results, Can u think of any other reason?
 
Old 07-21-2001, 10:40 PM   #12
Colonel Panic
Member
 
Registered: Jul 2001
Location: California
Distribution: Red Hat 7.1, Slackware 8.0
Posts: 216

Rep: Reputation: 30
You know, in Japanese, the word 'neko' means cat. Just to let you know...

*****Colonel Panic*****
 
Old 07-22-2001, 02:10 PM   #13
doodah
Member
 
Registered: Apr 2001
Location: Columbus,OH
Distribution: slackware
Posts: 122

Rep: Reputation: 15
Quote:
I did the compile, gcc hello.xx -o hello...
this is c++ source right? try to use...

% g++ hello.cpp -Wall -o runMe

i dont know if you have to have the source file as a *.cpp; but i always do and it always works, but definately use the ' g++' cuz that turns on all the opts for c++, and also sends you to the right libs...

oh yeh always use -Wall, somtimes its a bitch.. but youll keep your code clean
 
  


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
Fortran compiler gcc-g77 installation problem refp16 Linux - Software 6 11-26-2005 12:49 PM
compile( gcc-g77) fortran with fedora core 3 gambato79 Programming 1 05-06-2005 12:49 PM
gcc/g77 compiler in FC2? serendipitysdc Fedora 1 06-24-2004 04:19 PM
trouble installing g77 and gcc-3.2.2-3 almrud Mandriva 2 09-04-2003 07:07 PM
Need help !! Emergency !!! f2c/gcc , g77 issue xudeyong Linux - Software 1 05-02-2003 08:57 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:09 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
Open Source Consulting | Domain Registration