LinuxQuestions.org
Help answer threads with 0 replies.
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 07-25-2004, 05:11 AM   #1
lasindi
Member
 
Registered: Apr 2004
Distribution: Slackware, Ubuntu
Posts: 101

Rep: Reputation: 15
Unhappy Program starts from command line but not from file browser


I've been working on a program to solve stoichiometry problems (stoichiometry is a part of chemistry; don't worry if you don't understand it, my problem has nothing to do with it). I wrote it with the QT designer. The most glaring issue by far now is that you can start it from the command line ("./stoichiometrysolver" works) but if you try double-clicking on it in a file browser like Konqueror or Nautilus, it won't work. It will just hang as it uses up 100% CPU. You can download the source here. (Merely clicking this link doesn't work; it will work if you click it while holding Ctrl in Mozilla/Firefox.) You'll need Qt's libraries to compile. Does anyone have any idea how to solve this?

lasindi
 
Old 07-25-2004, 06:14 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
I haven't read your source code but here's a quick workaround. Create a bash script to start it:

#!/bin/bash
cd <path to directory program is in>
./stoichiometry

Make a text file, name it dostoichiometry

Open a console and navigate to the directory where the text file is and do:

# chmod a+x dostoichiometry

Then when you click dostoichiometry it should open the program. Note, you should have no space on the first line of the script before "#!" or it won't work when you click on it, i.e. "#!" must start the line.

Last edited by kilgoretrout; 07-25-2004 at 07:27 AM.
 
Old 07-25-2004, 07:03 AM   #3
lasindi
Member
 
Registered: Apr 2004
Distribution: Slackware, Ubuntu
Posts: 101

Original Poster
Rep: Reputation: 15
Thanks a lot, works beautifully! I should have thought of that before. I wonder, since the script has to cd to the directory, does this mean that the problem with simply double clicking from a file browser was the working directory? Does clicking on a binary in Konqueror or Nautilus mean

/dir/dir/dir/binary

or

cd /dir/dir/dir
./binary

I'm asking this because my program relies on an external data file in the same directory, and if the file isn't there, it hangs on startup, even from the console.

Whatever the case, this workaround works great. Thanks again!

lasindi

Last edited by lasindi; 07-25-2004 at 07:09 AM.
 
Old 07-25-2004, 07:34 AM   #4
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,987

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
I'm not sure why it works but it probably has something to do with linking to the external data file. In linux, you will find many progams that actually start with a bash script; many games do and IIRC mozilla does as well. These are all programs that link to a lot of external libraries and the startup scripts set the the paths to these external files.
 
  


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
need to control a browser from the command line nephish Linux - Software 6 11-21-2005 05:55 PM
command line web browser chingyenccy Linux - Newbie 4 05-06-2005 07:41 AM
Command line version of Hardware Browser? weshutchins Linux - Hardware 2 09-22-2004 03:24 PM
Command-Line Browser JoshSmith41 Linux - Software 6 01-08-2004 12:42 PM
Viewing program messages when program isn't run from command line? Locura Linux - Software 1 09-27-2003 08:19 AM

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

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