Bug #15781 2009-05-31 07:53

resander

User environment not passed on when starting codeblocks from

For Ubuntu 8.10, codeblocks 5607, unixODBC 2.2.11.

The thread 'Program works from commandline, but not from codeblocks' in the General forum provides background and a minimal test program for this problem. Here is a summary:

FROM COMMANDLINE - WORKS

A program developed on codeblocks works on the command line when started from home environment like this:

ken@ken-desktop:~$ cd /home/ken/projects/lsken2/bin/Debug

ken@ken-desktop:~$ ./myprog

WHEN CODEBLOCKS STARTED FROM COMMANDLINE - WORKS

ken@ken-desktop:~$ /usr/bin/codeblocks.

This time my environment is inherited by codeblocks. Then if codeblocks starts myprog by exec/fork the environment would be passed on again, which is what myprog needs.

WHEN CODEBLOCKS STARTED FROM APPLICATIONS MENU - FAILS

Some environment variables are undefined and incorrect at entry of myprog. The program depends on these and fails to find libraries.

Possible cure?:

Start codeblocks from the home directory of the user. Maybe like this:

char * home = getenv ( "HOME" );

chdir ( home );

fork-and-exec ( myprog );

Category
 
Group
 
Status
Open
Close date
 
Assigned to