Hi there,

as I translated LyX 1.1.2 on my Sun Solaris 2.7 machine with gcc 2.95.2 I got the following error message:
 
filetools.C: In function `bool PutEnv(const string &)':
filetools.C:322: passing `const char *' as argument 1 of `putenv(char *)' discards qualifiers

 
So I edited the source code of the above written function in lyx-1.1.2/src/support/filetools.C in the following way
 
bool PutEnv(string const & envstr)
{
#ifdef WITH_WARNINGS
#warning Look at and fix this.
#endif
       // f.ex. what about error checking?
       int retval = 0;
#if HAVE_PUTENV
       // this leaks, but what can we do about it?
       //   Is doing a getenv() and a free() of the older value
        //   a good idea? (JMarc)
 
// I commented the following line:
//        retval = putenv((new string(envstr))->c_str());
// I inserted the three next lines
        char buf[512];
        strcpy( buf, envstr.c_str( ) );
        retval = putenv(buf);
#else
#ifdef HAVE_SETENV
        string varname;
       string str = envstr.split(varname,'=');
       retval = setenv(varname.c_str(), str.c_str(), true);
#endif
#endif
       return retval == 0;
}

The funny thing is, i was able to translate the code with a earlier version (2.7 or 2.8 - I don't know exactly) of gcc. Maybe they changed the signature of putenv.
 
Hope this helps you.
Thanks for LyX.
 
Christoph
 
-----------------------------------------
Christoph Weidling
Technical University of Ilmenau
BEGIN:VCARD
N:Weidling;Christoph
FN:Christoph Weidling
ORG:Technical Univertsity of Ilmenau
TEL;WORK;VOICE:+49-3677-692786
TEL;HOME;VOICE:+49-3677-203667
ADR;WORK:;BH 308;;Ilmenau;Thüringen;98684;Germany
LABEL;WORK;ENCODING=QUOTED-PRINTABLE:BH 308=0D=0AIlmenau, Th=FCringen 98684=0D=0AGermany
ADR;HOME:;;Weimarer Straße 62;Ilmenau;Thüringen;98693;Germany
LABEL;HOME;ENCODING=QUOTED-PRINTABLE:Weimarer Stra=DFe 62=0D=0AIlmenau, Th=FCringen 98693=0D=0AGermany
X-WAB-GENDER:Male
URL:http://www.tu-ilmenau.de/~ai025/
EMAIL;PREF;INTERNET:[EMAIL PROTECTED]
END:VCARD

Reply via email to