You are not logged in.
Pages: 1
is there a way to compile a program in linux for windows that contains unix headers (ie sys/socket.h)?
i've tried
i486-mingw32-gcc test.c -o test.exe -I/usr/include -L/usr/lib -static
but i get this:
In file included from /usr/include/sys/socket.h:40:0,
from test.c:1:
/usr/include/bits/socket.h:431:23: warning: 'struct mmsghdr' declared inside parameter list
/usr/include/bits/socket.h:431:23: warning: its scope is only this definition or declaration, which is probably not what you want
/tmp/cceCwExM.o:test.c:(.text+0x26): undefined reference to `_socket'
collect2: ld returned 1 exit status
the program i was compiling isnt anything fancy, just
#include <sys/socket.h>
#include <netdb.h>
int main(void) {
int s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
return 0;
}
is it even possible? in windows, one can use cygwin's posix implementation (or whatnot) but i cant find these headers/libs for mingw.
Last edited by The Mishanator (2011-04-21 05:21:55)
Offline
I'm not an expert on windows compilation, but I don't think that the mingw compiler targets the cygwin environment. I believe you'll have to use the cygwin gcc to do that, and I'm not sure if it supports cross compilation.
Offline
Is there a cygwin gcc for linux?
Offline
Like I said, I'm not sure, but a quick google search seems to indicate that you could compile a cygwin gcc on linux, but it's fairly involved.
Offline
Pages: 1