Pelles C forum
Pelles C => Bug reports => Topic started by: Fuerst on December 12, 2023, 07:05:05 PM
-
Compiling the following C-Code ...
#include <unistd.h>
#include <process.h>
int main(void)
{
return 0;
}
... using Pelles-C 12.00.2 fails:
O:\Sources\Test>pocc -Go test.c
C:\Program Files\PellesC\Include\process.h(99): error #2119: Redeclaration of 'execv', previously declared at C:\Program Files\PellesC\Include\unistd.h(85).
C:\Program Files\PellesC\Include\process.h(100): error #2119: Redeclaration of 'execve', previously declared at C:\Program Files\PellesC\Include\unistd.h(86).
C:\Program Files\PellesC\Include\process.h(101): error #2119: Redeclaration of 'execvp', previously declared at C:\Program Files\PellesC\Include\unistd.h(87).
-
Those headers are normally not used same time.
https://en.wikipedia.org/wiki/Process.h
-
In the C and C++ programming languages, unistd.h is the name of the header file that provides access to the POSIX operating system API.
https://en.wikipedia.org/wiki/Unistd.h
https://copyprogramming.com/howto/is-there-a-replacement-for-unistd-h-for-windows-visual-c
-
Bug confirmed.
The 3 functions are declared differently in the two headers:
// process.h
extern intptr_t __cdecl execv(const char *, char * const []);
extern intptr_t __cdecl execve(const char *, char * const [], char * const []);
extern intptr_t __cdecl execvp(const char *, char * const []);
// unistd.h
extern intptr_t __cdecl execv(const char *, const char * const []);
extern intptr_t __cdecl execve(const char *, const char * const [], const char * const []);
extern intptr_t __cdecl execvp(const char *, const char * const []);
-
It seems, that headers was mixed together.
From docs:
// process.h
extern intptr_t __cdecl execv(const char *, const char * const []);
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/execv-wexecv?view=msvc-170
// unistd.h
extern intptr_t __cdecl execv(const char *, char * const []);
https://linux.die.net/man/3/execv
-
It seems, that headers was mixed together.
From docs:
// process.h
extern intptr_t __cdecl execv(const char *, const char * const []);
https://learn.microsoft.com/en-us/cpp/c-runtime-library/reference/execv-wexecv?view=msvc-170
// unistd.h
extern intptr_t __cdecl execv(const char *, char * const []);
https://linux.die.net/man/3/execv
Yes, the problem is that MS is tollerant about those differences, while PellesC is stricly compliant with the standard and signal the error.
Anyway the SDK should be convergent to allow the use of both IMO.