www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Linux(kubuntu) Problem

reply Wolftousen Frozenwind <eliot.darkwolf gmail.com> writes:
A bit of information before i get to the meat of the issue.

I'm using kubuntu 7.10 OS
I'm using Eclipse IDE
Program uses SDL for windowing/key/mouse input
Program uses OpenGL for graphics
Using Phobos

Compiling the program presents 0 errors.
When i tell eclipse to run it, it runs just fine as it is expected to.
When I tell command line to run it, it runs just fine as it is expected to.

Problem is, when i click the icon from within the folder, it fails to run b/c
it doesn't load the files i need it to that hold textures.  It also doesn't
write to any files if i tell it to.  Tried as root and still wont run properly.

I'm using write, append, read from std.file.

Are there other read/write functions I should be using?
Mar 27 2008
next sibling parent reply Wolftousen Frozenwind <eliot.darkwolf gmail.com> writes:
Moved files to the home folder to attempt to run and got this error when i
attempted to run it from command line:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


       ---------------------- DirectFB v0.9.25 ---------------------
             (c) 2000-2002  convergence integrated media GmbH
             (c) 2002-2004  convergence GmbH
        -----------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2007-08-07 19:21)
(*) Direct/Memcpy: Using MMX optimized memcpy()
(!) Direct/Util: opening '/dev/fb0' and '/dev/fb/0' failed
    --> No such file or directory
(!) DirectFB/FBDev: Error opening framebuffer device!
(!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable.
(!) DirectFB/Core: Could not initialize 'system' core!
    --> Initialization error!
Segmentation fault (core dumped)

No change in being able to run it by clicking the icon though,
still very puzzled
Mar 27 2008
next sibling parent Wolftousen Frozenwind <eliot.darkwolf gmail.com> writes:
Forgot, those errors occured while in command line as root and not my account...
Mar 27 2008
prev sibling parent gide _nospam_btinernet.com writes:
On Thu, 27 Mar 2008 13:37:51 -0400, Wolftousen Frozenwind
<eliot.darkwolf gmail.com> wrote:

Moved files to the home folder to attempt to run and got this error when i
attempted to run it from command line:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


       ---------------------- DirectFB v0.9.25 ---------------------
             (c) 2000-2002  convergence integrated media GmbH
             (c) 2002-2004  convergence GmbH
        -----------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2007-08-07 19:21)
(*) Direct/Memcpy: Using MMX optimized memcpy()
(!) Direct/Util: opening '/dev/fb0' and '/dev/fb/0' failed
    --> No such file or directory
(!) DirectFB/FBDev: Error opening framebuffer device!
(!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable.
(!) DirectFB/Core: Could not initialize 'system' core!
    --> Initialization error!
Segmentation fault (core dumped)

No change in being able to run it by clicking the icon though,
still very puzzled
It is possible that display has not been set or your local machine is not allowed X server connections. Try entering the command 'xhost +' as root or setting the DISPLAY environment variable to your local machine, e.g. export DISPLAY="localhost:0.0" Hope this helps. Gide
Mar 28 2008
prev sibling parent reply Wolftousen Frozenwind <eliot.darkwolf gmail.com> writes:
gide _nospam_btinernet.com Wrote:

 On Thu, 27 Mar 2008 13:37:51 -0400, Wolftousen Frozenwind
 <eliot.darkwolf gmail.com> wrote:
 
Moved files to the home folder to attempt to run and got this error when i
attempted to run it from command line:

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified

Xlib: connection to ":0.0" refused by server
Xlib: No protocol specified


       ---------------------- DirectFB v0.9.25 ---------------------
             (c) 2000-2002  convergence integrated media GmbH
             (c) 2002-2004  convergence GmbH
        -----------------------------------------------------------

(*) DirectFB/Core: Single Application Core. (2007-08-07 19:21)
(*) Direct/Memcpy: Using MMX optimized memcpy()
(!) Direct/Util: opening '/dev/fb0' and '/dev/fb/0' failed
    --> No such file or directory
(!) DirectFB/FBDev: Error opening framebuffer device!
(!) DirectFB/FBDev: Use 'fbdev' option or set FRAMEBUFFER environment variable.
(!) DirectFB/Core: Could not initialize 'system' core!
    --> Initialization error!
Segmentation fault (core dumped)

No change in being able to run it by clicking the icon though,
still very puzzled
It is possible that display has not been set or your local machine is not allowed X server connections. Try entering the command 'xhost +' as root or setting the DISPLAY environment variable to your local machine, e.g. export DISPLAY="localhost:0.0" Hope this helps. Gide
Not super worried about the x server not wanting to create my window when i'm running as root, but thanks for the advice and will try it once i get whatever other error is going on fixed. I added in additional error handling code to try and locate what was going on and found for certain that when using the void[] read(char[] filename) and void write(char[] filename, void*) functions that they don't do anything when not running my program from within the console or from within eclipse. has anyone else had an error like this or should i be using different functions for read/write from the std.file module?
Mar 28 2008
parent reply Tower Ty <towerty msn.com.au> writes:
 I added in additional error handling code to try and locate what was going on
and found for certain that when using the void[] read(char[] filename) and void
write(char[] filename, void*) functions that they don't do anything when not
running my program from within the console or from within eclipse.
 
 has anyone else had an error like this or should i be using different
functions for read/write from the std.file module?
with Linux when an executeable does not do anything it may not have the correct permissions set . Could this be your problem here? Check executeable,owner and group are what you want. You must be in the same directory as the executeable or have the $PATH set to where it is or and more . But explain what you mean by run in console and run in eclipse? Here is some of the stuff I use char[] input = cast(char[])File("number.int").read; char[][] readFile() { auto content = cast(char[][]) File("outfile.txt").read; void writeFile(char[][] content) { File output = new File ("outfile.txt"); try{ output.write(content); Stdout("Successfully over-wrote to file 'outfile.txt'").newline;} catch (AddressException xy){ Stdout("A file exception occured: " ~ xy.toString()).newline;} void writeNo(int docno) { File output = new File ("number.int"); try{ void[] y = to!(char[])(docno); output.write(y); Stdout("Successfully over-wrote to file 'number.int'").newline;} catch (AddressException xy){ Stdout("A file exception occured: " ~ xy.toString()).newline;} }
Mar 29 2008
next sibling parent Tower Ty <towerty msn.com.au> writes:
Mine are in Tango by the way
Mar 29 2008
prev sibling parent reply Wolftousen Frozenwind <eliot.darkwolf gmail.com> writes:
Tower  Ty Wrote:

 You must be in the same directory as the executeable or have the $PATH set to
where it is or and more . But explain what you mean by run in console and run
in eclipse?
When i'm in the folder with the executable inside the kconsole, and type ./program_name, the program runs just fine. Finds all the files and loads the properly. Same with eclipse, right after i compile, i click run as D program and it runs just fine, loading all the files properly. I was running into problems when running it by clicking the program icon inside the Dolphin (folder explorer). I found (should have check this before posting) that when you run in eclipse or console that it uses the directory you are in (knew this, didn't think about it till just now) and that when you click a executable icon, no matter where you click it from, your directory changes to /home/user_name... which was causing my files to not be found and thus not loaded... resolved the error by using getcwd() and changing my directory within the program before loading files... haven't done much file io in linux so this was a good learning experience...
Mar 29 2008
parent "Neil Vice" <psgdg swiftdsl.com.au> writes:
"Wolftousen Frozenwind" <eliot.darkwolf gmail.com> wrote in message 
news:fsn85h$2812$1 digitalmars.com...
 Tower  Ty Wrote:

 You must be in the same directory as the executeable or have the $PATH 
 set to where it is or and more . But explain what you mean by run in 
 console and run in eclipse?
When i'm in the folder with the executable inside the kconsole, and type ./program_name, the program runs just fine. Finds all the files and loads the properly. Same with eclipse, right after i compile, i click run as D program and it runs just fine, loading all the files properly. I was running into problems when running it by clicking the program icon inside the Dolphin (folder explorer). I found (should have check this before posting) that when you run in eclipse or console that it uses the directory you are in (knew this, didn't think about it till just now) and that when you click a executable icon, no matter where you click it from, your directory changes to /home/user_name... which was causing my files to not be found and thus not loaded... resolved the error by using getcwd() and changing my directory within the program before loading files... haven't done much file io in linux so this was a good learning experience...
It sounds like that may just be a "feature" of Dolphin perhaps?
Mar 30 2008