Linux vs Windows

Linux vs Windows

Hello everyone!I have one problem:I want to work on my code in Windows, but I am having problems with functions setenv() and unsetenv().I know that they aren't implemented in Windows, so I have tried to add:

#if defined _WIN32 # include <windows.h> #endif
int setenv(char * lpname, char * lpvalue, int overwrite) {if( SetEnvironmentVariableA(lpname, lpvalue) == 0 ){return(-1);} else { return(0); } }
int unsetenv(char * lpname) {if( SetEnvironmentVariableA(lpname, "") == 0 ){return(-1); } else { return(0); } },

but the output  files have no information considering flight plans.Can someone please help me?
Thanks in advance!

publicaciones de 3 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.


I don't have exactly the answer but I will try to help you, waiting someone that have the answer (hope so...).

Did you uncomment the print_params call in the main function ?
Does this call give you the right string about parameters that depends on the "convert_string_to_timestamp" (which use timegt() function, which use the setenv() and the unsetenv() functions) ?
-> For example, does the "ar_time_min" has the waited value ?
In my opinion, if not, it should come from the function you defined here (or maybe did you modify something elsewhere ? It happens !) because if these strings are false, it will pretty surely disturb the algorithm and your output won't be the good ones (or won't be there at all)... Try this direction, maybe, by verifying the parameters attributes with the print_params function... and do not hesitate to give more details for your problem if you can !

Something else, what did Google (or anything else x)) told you about these environment variable ?

Anyway, someone in the forum may knows the answer, but I hope it helped you a little...

But remember that you have to give something that works with the brenchmark (Linux version) ! :)


Timothé Viot,
Engineer student, Insa Rennes 1

Hi !

I succeed to compile on windows. You should use cygwin or mingwin with gcc/make packages. In the default main.cpp, just delete the function timegm(struct tm *tm), setenv/getenv/unsetenv don't work but this function is already implemented.

If you really want a full windows env., try to find a "timegm" equivalent (already implemented or custom version)


Deje un comentario

Por favor inicie sesión para agregar un comentario. ¿No es socio? Únase ya