LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 06-13-2010, 05:54 AM   #1
insanity99
LQ Newbie
 
Registered: Jun 2010
Location: Liverpool, England
Distribution: Ubuntu 10.4
Posts: 23

Rep: Reputation: 0
made a program in pascal but cant open it.


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

 
Old 06-13-2010, 07:31 AM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
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.
 
Old 01-04-2012, 07:29 PM   #3
jwdietrich
LQ Newbie
 
Registered: Jan 2012
Location: Planet Earth, Solar System, Orion-Cygnus Arm, Milky Way, Local Group of Galaxies
Distribution: openSUSE, Raspbian Wheezy
Posts: 7

Rep: Reputation: Disabled
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.
 
Old 01-04-2012, 07:58 PM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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.

jlinkels
 
Old 01-05-2012, 12:47 PM   #5
jwdietrich
LQ Newbie
 
Registered: Jan 2012
Location: Planet Earth, Solar System, Orion-Cygnus Arm, Milky Way, Local Group of Galaxies
Distribution: openSUSE, Raspbian Wheezy
Posts: 7

Rep: Reputation: Disabled
Quote:
Originally Posted by jlinkels View Post
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.
 
Old 01-05-2012, 04:06 PM   #6
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
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.

jlinkels

Last edited by jlinkels; 01-06-2012 at 03:32 PM.
 
Old 01-06-2012, 01:07 PM   #7
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
Quote:
Originally Posted by jlinkels View Post
Call it from the command line:
youfilename
For most people, that probably should be
Code:
./yourfilename
, as '.' will not be in $PATH.

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.

--- rod.
 
Old 01-06-2012, 03:30 PM   #8
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Quote:
Originally Posted by theNbomr View Post
Code:
./yourfilename
Darn... forgot that
jlinkels
 
  


Reply



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
Just installed Pascal compiler to Debian. Howto open it? richag77 Linux - Software 2 12-02-2008 10:56 PM
Help with debugging Pascal program wanted. Doctorzongo Programming 4 04-13-2008 05:11 PM
in Pascal: how to exec a program, discard text output or send to text file Valkyrie_of_valhalla Programming 6 05-02-2007 09:50 AM
pascal program amer_58 Linux - Newbie 8 08-30-2005 12:56 PM
How to run pascal program in Linux? zWaR Programming 5 02-04-2004 02:52 AM

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

All times are GMT -5. The time now is 11:29 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