Simple Networking Program in C

This is a discussion on Simple Networking Program in C within the C Programming forums, part of the General Programming Boards category; Hey, this is the server program part of my program. It's pretty simple, I've provided the link of my code. ...

  1. #1
    Registered User
    Join Date
    May 2004
    Posts
    215

    Simple Networking Program in C

    Hey, this is the server program part of my program. It's pretty simple, I've provided the link of my code. The problem I am having is that when I compile, everything compiles fine, but when I try to execute i get these errors. Here's my code to view it, its pretty short. Ive also documented it as well. Please help

    http://sourcepost.sytes.net/sourcevi...ource_id=14412

    is where my code will be.

    below is the error i get when trying to execute.

    --------------------Configuration: Server - Win32 Debug--------------------
    Linking...
    Server.obj : error LNK2001: unresolved external symbol _snprintf
    Server.obj : error LNK2001: unresolved external symbol _accept@12
    Server.obj : error LNK2001: unresolved external symbol _listen@8
    Server.obj : error LNK2001: unresolved external symbol _bind@12
    Server.obj : error LNK2001: unresolved external symbol _htons@4
    Server.obj : error LNK2001: unresolved external symbol _htonl@4
    Server.obj : error LNK2001: unresolved external symbol _socket@12
    Debug/Server.exe : fatal error LNK1120: 7 unresolved externals
    Error executing link.exe.

    Server.exe - 8 error(s), 0 warning(s)


    Im using Windows instead of unix, so anyways, to view my code heres the link

    http://sourcepost.sytes.net/sourcevi...ource_id=14412


    Thanks.

  2. #2
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    I think you have to link with winsock, so go to your compiler options and add "-lwinsock" or something similar, research windows sockets on google.com
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  3. #3
    Registered User
    Join Date
    May 2004
    Posts
    215
    How exactly to I do that, I went to options under tools, but I couldnt find how to link with winsock.

    Thanks.

  4. #4
    Obsessed with C chrismiceli's Avatar
    Join Date
    Jan 2003
    Posts
    501
    What compiler/ide are you using?
    Help populate a c/c++ help irc channel
    server: irc://irc.efnet.net
    channel: #c

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    VC++6.0: Project -> Settings -> Link (tab) -> Input (category) -> Object/library modules: (Append Ws2_32.lib

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help with a very simple program
    By htdefiant in forum C++ Programming
    Replies: 13
    Last Post: 08-14-2007, 01:27 PM
  2. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  3. [Help] Simple Array/Pointer Program
    By sandwater in forum C Programming
    Replies: 3
    Last Post: 03-30-2007, 02:42 PM
  4. simple silly program
    By verbity in forum C Programming
    Replies: 5
    Last Post: 12-19-2006, 05:06 PM
  5. Simple simple program
    By Ryback in forum C++ Programming
    Replies: 10
    Last Post: 09-09-2004, 05:48 AM

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