LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Windows programs in gcc (https://www.linuxquestions.org/questions/programming-9/windows-programs-in-gcc-304175/)

velan 03-21-2005 01:54 AM

Windows programs in gcc
 
How do I compile Windows C code in gcc linux? it's basically a Windows socket progframming code (includes winsock.h. etc). I forget the option which we have to give to gcc, so that the program will be compiled successfully. help me out pls ...

ichrispa 03-21-2005 05:12 AM

This might just get to be a problem...

I was trying to write network programs under wi... windo..., god forgive me, windows using djgpp but there is just single glitch - windows uses .lib s, linux .a . In theory you have to link your program to something looking like libwinsock.a - but that does not exist.

The easiest way to do this is to change the headers one by one to whatever equivalent exists in linux (socket.h, types, in.h, arpa.h etc.). Its a lot of work to do. If however you have found a way to reuse windows libraries through linux then what you need is this:

gcc your_sourc_efile -o name_of_output -l library_in_searchpath

good luck

deiussum 03-21-2005 08:26 AM

If you are using Cygwin, I believe you can use something like the -mwin parameter.

Windows itself doesn't use .lib files. Some Windows compilers like MS VC++ use .lib files. Cygwin's compiler also uses .a, and .la, and sometimes .dll.a...

Anyway, what sort of errors do you get? If you still have problems, give some more specific info, like what Windows GNU compiler you are using. (Cygwin's, Mingw, etc.)

Edit: Just noticed you are trying to compile a Windows program in Linux using gcc, not trying to use a Window's version of gcc. I don't have any sort of experience with that, but you'd need some form of cross-compiler.


All times are GMT -5. The time now is 05:34 AM.