Mising some link

Paulo Wilbert pwilbert@uninet.com.br
Sat Aug 2 21:52:00 GMT 2003


At 15:47 2/8/2003 -0500, Wayne wrote:
>Waynes-a-dummy question:
>
>Can you link a library that way in GCC?  Have your
>tried linking the library from your command line?
>
>Wayne

I suppose so. For test that and to asseverate that all the #include's are 
working I tried the following code that worked fine. I am using MinGW-2.0 
package that contains GCC-3.2, binutils-1.3, gdb-5.1.1 and make-3.79.1, 
mingw-runtime-2.2 and w32api-2.0.

---------------------------------------
#include <stdio.h>
#include <winsock2.h>
#include <windows.h>
#include <process.h>
#include <string.h>
#include <winbase.h>
#pragma  comment(lib,"ws2_32")

void main(int argc,char ** argv)
{
       printf ("Hello\n");
}
------------------------------------------

When I enter the full code with calls to the entry-points (WSAStartup, 
Sockt, etc.) I got the errors.

Looking at some GCC documentation I understood that GCC does all the job 
(preprocessing, compiling and linking). By use the command line to link the 
library do you mean use the 'ld' command?

Rgds,

Paulo 



More information about the Gcc-help mailing list