• Viernes 17 de Mayo de 2024, 04:47

Autor Tema:  Ayuda Dev-c++???  (Leído 1672 veces)

zed2000

  • Miembro activo
  • **
  • Mensajes: 31
    • Ver Perfil
Ayuda Dev-c++???
« en: Viernes 3 de Noviembre de 2006, 22:30 »
0
Bajé el siguiente código de un sitio y lo compilo en el Dev-c++ pero me arroja los sgtes errores....
   
   [Linker error] undefined reference to `WSAStartup@8'
   [Linker error] undefined reference to `gethostbyname@4'
   [Linker error] undefined reference to `inet_ntoa@4'
   [Linker error] undefined reference to `WSACleanup@0'
   ld returned 1 exit status

#include <winsock2.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>

hostent *p;
char *alias;
int i;
IN_ADDR add;
char argv[]="localhost";
char a[100];
int main()
{
   
   
   WSADATA wsaData;

   if (WSAStartup(MAKEWORD(1, 1), &wsaData) !=0){

      return 1;
   }
   
   p=gethostbyname(argv);
   
   if (p==NULL)
   {
      strerror(errno);
   
      return 1;
   }
   else
   {
   
      memcpy(&add.S_un,p->h_addr_list[0],p->h_length);
      sprintf (a,"%s",inet_ntoa(add));
      
   }
    printf ("%s",a);

   WSACleanup();
   return 0;
}


y al linkear con la libreria

1. Press ALT + P
2. Then go to the “Perimeters TAB”
3. Then click the button “Add library or Object” button
4. Now go to the directory where Dev C++ is installed.
5. Go to the “lib” file and search for the file:
6. And open the file “libws2_32.a”
7. Then click Ok
me devuelve el siguiente error.

  cannot find -lobjc
  ld returned 1 exit status

alguna sugerencia????

SteelX

  • Miembro MUY activo
  • ***
  • Mensajes: 218
    • Ver Perfil
Re: Ayuda Dev-c++???
« Respuesta #1 en: Miércoles 8 de Noviembre de 2006, 16:59 »
0
tu “Perimeters TAB” , no lo encontre por ningun lado. la parte de agregar la libreria esta en "aditional Command- line options". en Add library or Object

depronto es problema de la misma libreria.

pero evidentemente son errores de encadenamiento por buscar funciones que estan en la libreria.
Inside the code