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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
07-10-2001, 03:43 AM
|
#1
|
LQ Newbie
Registered: Jul 2001
Posts: 3
Rep:
|
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.
|
|
|
07-10-2001, 03:59 AM
|
#2
|
Member
Registered: Jun 2001
Location: Northern Ohio
Distribution: RedHat, Engarde and LFS
Posts: 237
Rep:
|
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
|
|
|
07-11-2001, 02:00 AM
|
#3
|
LQ Newbie
Registered: Jul 2001
Posts: 3
Original Poster
Rep:
|
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 ?
|
|
|
07-11-2001, 03:50 AM
|
#4
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
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...
|
|
|
07-11-2001, 03:56 AM
|
#5
|
Senior Member
Registered: Jun 2001
Posts: 1,635
Rep:
|
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.
|
|
|
07-11-2001, 04:00 AM
|
#6
|
Senior Member
Registered: May 2001
Location: Bristol, UK
Distribution: Slackware, Fedora, RHES
Posts: 2,243
Rep:
|
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...
|
|
|
07-11-2001, 04:08 AM
|
#7
|
Senior Member
Registered: Jun 2001
Posts: 1,635
Rep:
|
sorry about that jamie... i edited the massively erroneous parts of that last post... <- you know, you really need a smiley for extreme embarrasment.
|
|
|
07-16-2001, 03:00 AM
|
#8
|
LQ Newbie
Registered: Jul 2001
Posts: 3
Original Poster
Rep:
|
Thanks
Thanks a lot to you... I begin to understand better the role of the PATH.
|
|
|
07-20-2001, 06:39 PM
|
#9
|
Member
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223
Rep:
|
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???
|
|
|
07-21-2001, 01:14 AM
|
#10
|
Senior Member
Registered: Jun 2001
Posts: 1,635
Rep:
|
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.
|
|
|
07-21-2001, 04:35 AM
|
#11
|
Member
Registered: Jun 2001
Location: (Cashville) Nashville, TN
Distribution: CentOS 4.0, Slackware 10.2,
Posts: 223
Rep:
|
I tried that....and still got the same results, Can u think of any other reason?
|
|
|
07-21-2001, 10:40 PM
|
#12
|
Member
Registered: Jul 2001
Location: California
Distribution: Red Hat 7.1, Slackware 8.0
Posts: 216
Rep:
|
You know, in Japanese, the word 'neko' means cat. Just to let you know...
*****Colonel Panic*****
|
|
|
07-22-2001, 02:10 PM
|
#13
|
Member
Registered: Apr 2001
Location: Columbus,OH
Distribution: slackware
Posts: 122
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 09:09 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|