cannot find -lobjc

This is a discussion on cannot find -lobjc within the C Programming forums, part of the General Programming Boards category; Compiler: Default compiler Building Makefile: "F:\DEV-CppPortable\App\devcpp\Makefile.win" Executing make... make.exe -f "F:\DEV-CppPortable\App\devcpp\Makefile.win" all gcc.exe client.server.o -o "Project1.exe" -L"F:/DEV-CppPortable/App/devcpp/lib" -lwsock32 -lobjc F:\DEV-CppPortable\App\devcpp\Bin\..\lib\gcc\mingw32.4. ...

  1. #1
    Registered User
    Join Date
    Apr 2008
    Posts
    9

    cannot find -lobjc

    Compiler: Default compiler
    Building Makefile: "F:\DEV-CppPortable\App\devcpp\Makefile.win"
    Executing make...
    make.exe -f "F:\DEV-CppPortable\App\devcpp\Makefile.win" all
    gcc.exe client.server.o -o "Project1.exe" -L"F:/DEV-CppPortable/App/devcpp/lib" -lwsock32 -lobjc

    F:\DEV-CppPortable\App\devcpp\Bin\..\lib\gcc\mingw32\3.4. 2\..\..\..\..\mingw32\bin\ld.exe: cannot find -lobjc
    collect2: ld returned 1 exit status

    make.exe: *** [Project1.exe] Error 1

    Execution terminated


    what is -lobjc ??how to solve it?

    my fail
    Code:
    #include <stdio.h> 
    #include <windows.h>         /* These are the usual header files */
    //#include <winsock.h>
    #include <winsock2.h>
    
    //#include <winsock32.h>
    
    #define PORT 3550   /* Port that will be opened */ 
    #define BACKLOG 2   /* Number of allowed connections */
    
    main()
    {
     
      int fd, fd2; /* file descriptors */
    
      struct sockaddr_in server; /* server's address information */
      struct sockaddr_in client; /* client's address information */
    
      int sin_size;
    
    
      if ((fd=socket(AF_INET, SOCK_STREAM, 0)) == -1 ){  /* calls socket() */
        printf("socket() error\n");
        exit(-1);
      }
    
     server.sin_family = AF_INET;         
     server.sin_port = htons(PORT); 
    server.sin_addr.s_addr = INADDR_ANY;  /* INADDR_ANY puts your IP address automatically */   
      bzero(&(server.sin_zero),8); /* zero the rest of the structure */
    
      
      if(bind(fd,(struct sockaddr*)&server,sizeof(struct sockaddr))==-1){ /* calls bind() */
          printf("bind() error\n");
          exit(-1);
      }     
    
      if(listen(fd,BACKLOG) == -1){  /* calls listen() */
          printf("listen() error\n");
          exit(-1);
      }
    
    while(1){
      sin_size=sizeof(struct sockaddr_in);
      if ((fd2 = accept(fd,(struct sockaddr *)&client,&sin_size))==-1){ /* calls accept() */
        printf("accept() error\n");
        exit(-1);
      }
      
      printf("You got a connection from %s\n",inet_ntoa(client.sin_addr) ); /* prints client's IP */
      
      send(fd2,"Welcome to my server.\n",22,0); /* send to the client welcome message */
      
      close(fd2); /*  close fd2 */
    }
    }
    http://img148.imageshack.us/img148/2...ing1iu9.th.jpg

    http://img139.imageshack.us/img139/8...ing2fy4.th.jpg


    please help me....

  2. #2
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    You need the following headers:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <stdarg.h>
    #include <errno.h>

    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    Google searches do wonders.
    =========================================
    Everytime you segfault, you murder some part of the world

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,821
    objc is the objective C library.
    Why do you need it?
    http://en.wikipedia.org/wiki/Objective-C
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by JFonseka View Post
    You need the following headers:
    Headers cannot be the source of a link error. I think he's got the IDE set to some weird settings where it's passing "-lobjc" on the link line.

  5. #5
    Nub SWE
    Join Date
    Mar 2008
    Location
    Dallas, TX
    Posts
    133
    Putting in a return type for main() wouldn't hurt.

  6. #6
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  7. #7
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    Well when I compiled his program first I got errors, when I included those headers, there were no problems.
    =========================================
    Everytime you segfault, you murder some part of the world

  8. #8
    Registered User
    Join Date
    Apr 2008
    Posts
    9
    maybe this coding more suitable for linux?i am using window xp+ dev c++ portable.What compiler most suitable for winsock programming?

  9. #9
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,185
    We seem to have a confusion of OS here. I doubt that a linux environment would be the most suitable environment for Windows Sockets programming.

    You have somehow checked a box in your Dev-C++ IDE that you don't want checked. IIRC, it's under Tools->Compiler Options ... look over your settings and uncheck the one that says "Objective C". Alternatively, if you typed that in yourself in the "libraries" line, take it out.

  10. #10
    Registered User
    Join Date
    Apr 2008
    Posts
    9
    i found that file at google and replace linux header with winsock header for testing.It good or not?i think not good.Forgive me i still beginner.

  11. #11
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    That's never a good thing. Use a windows compiler for doing Windows stuff or a linux compiler for linux stuff and you won't get into trouble.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  12. #12
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    1) What OS
    2) What headers did you replace
    3) Cygwin is pretty good for winsock programming (I think)

    Take my opinions with a grain of salt.
    =========================================
    Everytime you segfault, you murder some part of the world

  13. #13
    Registered User
    Join Date
    Apr 2008
    Posts
    9
    1) What OS : Window XP SP2
    2) What headers did you replace
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <stdarg.h>
    #include <errno.h>

    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>

    with....

    #include <stdio.h>
    #include <windows.h> /* These are the usual header files */
    #include <winsock.h>
    #include <winsock2.h>
    #pragma comment(lib, "wsock32.lib")
    //#include <winsock32.h>



    3) Cygwin is pretty good for winsock programming (I think)

    i try now!

  14. #14
    Cogito Ergo Sum
    Join Date
    Mar 2007
    Location
    Sydney, Australia
    Posts
    463
    No...use these files:

    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <stdarg.h>
    #include <errno.h>

    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <arpa/inet.h>
    #include <netdb.h>
    I tried running the program, it didn't print out anything, though my windows firewall popped up asking me if i wanted to block the connection, so I guess the connection was made.
    =========================================
    Everytime you segfault, you murder some part of the world

  15. #15
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Posts
    22,985
    Don't use Windows Firewall!
    It may off topic, but Windows Firewall is at the bottom of all firewalls made. Any 3rd party solution is much better. Even Symantec which is known to have poor quality products these days.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 10:13 AM
  2. could not find -lwsock32.lib
    By thomas_joyee in forum C++ Programming
    Replies: 8
    Last Post: 07-14-2008, 01:28 PM
  3. How to find O of threads ?
    By jabka in forum C Programming
    Replies: 3
    Last Post: 03-11-2008, 01:25 PM
  4. how do u find 2nd largest number??
    By juancardenas in forum C Programming
    Replies: 8
    Last Post: 02-14-2003, 08:28 AM
  5. Q: Recursion to find all paths of a maze
    By reti in forum C Programming
    Replies: 7
    Last Post: 11-26-2002, 09:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21