ProgrammingThis 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.
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.
on ubuntu i just compiled my first program using lazarus and i can open it in terminal fine but if i double click the file simply marked 'hello' nothing happens. any idea why?
here is the source:
PHP Code:
program Hello; begin writeln ('Hello, world.'); readln end.
If you run a program like this from the GUI, there is no place to display the output. In the terminal, the terminal window is designated as the standard output, and so you see the results of the program.
Location: Planet Earth, Solar System, Orion-Cygnus Arm, Milky Way, Local Group of Galaxies
Distribution: openSUSE, Raspbian Wheezy
Posts: 7
Rep:
I have not exactly the same, but a similar problem with GUI applications. They work fine on the machine they were developed on with Lazarus / Free Pascal, but after moving to another machine nothing happens after clicking.
That is the main reason why I distribute my open source applications for Linux as sourcecode only, however the situation is quite dissatisfactory.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
I guess you are missing some libraries on the other machine. Try:
Code:
ldd /path/to/your/application
in a terminal and look for error messages.
If the libraries aren't there you have to install them.
That is why program depend on libraries or other programs, which sometimes leads to dependency hell.
Compiling from source isn't that bad either, many packages are distributed that way to be sure they will run once succesfully compiled.
Location: Planet Earth, Solar System, Orion-Cygnus Arm, Milky Way, Local Group of Galaxies
Distribution: openSUSE, Raspbian Wheezy
Posts: 7
Rep:
Quote:
Originally Posted by jlinkels
I guess you are missing some libraries on the other machine. Try:
Code:
ldd /path/to/your/application
in a terminal and look for error messages.
If the libraries aren't there you have to install them.
Thanks for the hint. However, the problem is that the application is not even recognized as a program. Double clicking reveals a dialog box asking to select an application to open the application with.
Sorry, this may be an all too simple beginner's question. I am familiar with Mac and Windows, but not so experienced with Linux. I am sure that there is a trivial solution, but I simply can't find it out.
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195
Rep:
Open a console. Move to the directory where your file is located.
Enter ls -l youfilename
When the file is displayed you should see somthing like this in the first column:
-rwxr-xr-x
If the 'x'es aren't there, Linux does you program consider not executable. It is this bit at nothing else (not .exe or so) what makes a program executable.
If the x is not there, do: chmod ug+x yourfilename
Now the user (owner) and group the file is owned by can execute.
Call it from the command line: ./yourfilename
and look for error messages.
And to the OP: when in Linux land, we distinguish between opening a file and executing or running a program or script. If a file is executable (and jlinkels has explained how to give it executable attributes), we run the program (as opposed to opening the file). Opening a file generally means something different, and implies that the file is data, not code, and we are viewing or editing the file in some way.
Windows-speak and Mac-speak go out of their way to blur this difficult concept, but Linux people are bright enough to get added value from the distinction. jlinkels also described to you the usual way of running a program. 'Double-clicking' can mean different things in different contexts, so telling someone you did that without adding the context is ambiguous. jlinkels was bright enough to detect your Windows-speak, guessed what you meant, and arrived at a likely correct answer to your problem.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.