POV-Ray : Newsgroups : povray.programming : .exe runs OK from IDE, but crashes when run from folder Server Time: 16 Jun 2019 07:01:43 GMT
  .exe runs OK from IDE, but crashes when run from folder (Message 1 to 2 of 2)  
From: stbenge
Subject: .exe runs OK from IDE, but crashes when run from folder
Date: 1 Sep 2010 22:22:43
Message: <4c7ed233@news.povray.org>
This problem is driving me insane. First off, I'm using a few libraries: 
SDL, CRM32Pro SDK, and png++. To get png++ to work, I had to link to 
libpng and zlib. I've been using SDL and CRM32Pro for quite some time, 
and I'm 99% sure they aren't the problem here. The problem first reared 
its ugly head yesterday when I began using png++ to write 16-bit 
grayscale images.

What happens is that I can compile and run my code without a hitch 
directly from Dev-C++'s IDE. However, when I run the program from its 
folder, everything works great until I try to save the image.

Here's the relevant code:

  char *file = "some_image.png";

  void SaveImage(){

   // set up image/format
   png::image< png::gray_pixel_16 > image(xs, ys);

   for(y=0;y<ys;y++){
    for(x=0;x<xs;x++){

     // copy 16-bit values from array into pixel
     png::gray_pixel_16 pix = arr_comp[x][y];

     // draw 16-bit values to image
     image[y][x] = pix;
    }
   }

   // save the image
   image.write(file);
  }

If I remove "image.write(file);," the program doesn't crash, so I'm 
assuming that that is where the problem lies.

I really don't want to go through the hassle of writing 16-bit output 
functions in SDL. Also, getting Visual C Express really isn't an option 
with my low bandwidth and the cruddy download manager that Microsoft has 
crafted for it.

Has anyone run into this problem before? I tried searching for a 
solution, and others have had similar problems, but they always boiled 
down to bad local directory filename prefixes. I'm only writing /to/ a 
file, and it really doesn't matter where it gets placed, the problem 
still exists.

Sam


Post a reply to this message

From: stbenge
Subject: Re: .exe runs OK from IDE, but crashes when run from folder
Date: 1 Sep 2010 22:47:20
Message: <4c7ed7f8$1@news.povray.org>
stbenge wrote:
> This problem is driving me insane. First off, I'm using a few libraries: 
> SDL, CRM32Pro SDK, and png++. To get png++ to work, I had to link to 
> libpng and zlib.

OK, I've found a solution. I copied "zlib1.dll" into my working 
directory, and now the program doesn't crash. Goofy me :/


Post a reply to this message

Copyright 2003-2008 Persistence of Vision Raytracer Pty. Ltd.