Page 1 of 1

can only run from terminal

Posted: Wed Oct 09, 2013 8:39 am
by byllgrim
if i doubleclick the executable and either choose execute, or execute in terminal, the irrlicht window appears and immediately closes, but if i navigate to the folder in terminal and ./execute_my_program it works. the same goes for the examples.

Re: can only run from terminal

Posted: Wed Oct 09, 2013 1:06 pm
by Nyx Erebos
There are not much information in your post. Does it do the same thing with other programs which don't use Irrlicht ? Just throwing a random thought : try to launch it in root mode from another terminal.

Edit : sorry I meant from another folder.

Re: can only run from terminal

Posted: Thu Oct 10, 2013 7:25 pm
by CuteAlien
Do you load something (textures, models....)? In that case it could be trouble with your working directory. You can test that with the following program which will write out the working folder and the path you get passed as parameter to your application by the operating system to a file called binpath.txt.

Code: Select all

 
#include <cstdio>
#include <unistd.h>
 
#ifndef MAXPATHLEN
#define MAXPATHLEN 1024
#endif // MAXPATHLEN
 
int main (int argc, char *argv[])
{
        FILE * f = fopen("binpath.txt", "a");
        char cwd[MAXPATHLEN];
    getcwd(cwd, MAXPATHLEN);    
        
        printf("cwd: %s\n", cwd);
        fprintf(f, "cwd: %s\n", cwd);
        
        for (int i = 0; i < argc; i++)
        {
                printf("argv[%d]: %s\n", i, argv[i]);
                fprintf(f, "argv[%d]: %s\n", i, argv[i]);
        }
                
        fclose(f);
 
        return 0;
}