C++ winsock question
Results 1 to 6 of 6

Thread: C++ winsock question

  1. #1
    Senior Member
    Join Date
    Jun 2003
    Posts
    772

    C++ winsock question

    I use Borland C++ compiler (latest version).

    I found this tutorial via a post mathgirl made:
    http://www.hal-pc.org/~johnnie2/winsock.html

    Remember that any code presented in this tutorial should be linked with the Winsock library, usually wsock32.lib or something similarly named
    How do I do that? I've searched this forum and google but I can't seem to find the answer...

    Thx

    EDIT: if you know any tutorials on networking in c++ (windows) please post them, they are hard to find.
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  2. #2
    Senior Member Info Tech Geek's Avatar
    Join Date
    Jan 2003
    Location
    Vernon, CT
    Posts
    828
    You need to modify your project linker settings to include wsock32.lib in order to link with the Winsock2 library.

    header file = winsock.h, winsock2.h
    libraries = wsock32.lib, w2_32.lib

    You can also list the SocketsPP.lib before the wsock32.lib in your linker specification

  3. #3
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    ? How do I do that? Sorry to ask such annoying questions, started learning c++ only 3 days ago or something.
    This is the configuration file of my linker at the moment:

    -L"c:\Borland\Bcc55\lib"

    Should I add something to that for the library files?
    -L = the switch to specify library search paths

    And for the header files, can't I just:

    #include <winsock.h>
    #include <winsock2.h>

    ??
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

  4. #4
    Senior Member Info Tech Geek's Avatar
    Join Date
    Jan 2003
    Location
    Vernon, CT
    Posts
    828
    (b) Compiling and Linking Application Programs:

    Now you can use the LEDA libraries as follows to compile and link your application programs.
    We use <LEDA> to indicate the root directory of your LEDA installation, e.g., c: \LEDA-4.4.1 \.

    Programs using basic data types:

    bcc32 -P -I<LEDA>\incl -L<LEDA> prog.c libl.lib

    Programs using graph data types:

    bcc32 -P -I<LEDA>\incl -L<LEDA> prog.c libg.lib libl.lib

    Programs using geometric data types:

    bcc32 -P -I<LEDA>\incl -L<LEDA prog.c libp.lib libg.lib libl.lib

    Programs using three-dimensional data types:

    bcc32 -P -I<LEDA>\incl -L<LEDA> prog.c libd3.lib libp.lib libg.lib\
    libl.lib

    Programs using graphics data types:

    bcc32 -P -I<LEDA>\incl -L<LEDA> prog.c libw.lib libp.lib libg.lib\
    libl.lib wsock32.lib user32.lib gdi32.lib comdlg32.lib shell32.lib\
    advapi32.lib

    Programs using GeoWin:

    bcc32 -P -I<LEDA>\incl -L<LEDA> prog.c libgeow.lib libd3.lib\
    libw.lib libp.lib libg.lib libl.lib wsock32.lib\
    user32.lib gdi32.lib comdlg32.lib shell32.lib advapi32.lib

    http://www.algorithmic-solutions.inf...s_Borland.html

  5. #5
    Senior Member Info Tech Geek's Avatar
    Join Date
    Jan 2003
    Location
    Vernon, CT
    Posts
    828
    3 resources I use: C++ For Dummies, Visual C++ The Complete Reference (McGrawHill), The C++ Programming Language Third Edition.

  6. #6
    Senior Member
    Join Date
    Jun 2003
    Posts
    772
    Still doesn't work
    I do this:
    C:\>bcc32 +C:\borland\bcc55\bcc32.cfg -L net.cpp C:\borland\bcc55\lib\psdk\wsock32.lib C:\Borland\bcc55\lib\psdk\ws2_32.lib

    content of bcc32.cfg
    -------------------------

    -I"c:\Borland\Bcc55\include"
    -L"c:\Borland\Bcc55\lib"

    It compiles, but when it starts linking:
    Error: Unresolved external '_main' referenced from C:\BORLAND\BCC55\LIB\C0X32.OB
    J

    Do you know how to solve this?

    Thanks for the help you already gave.
    The above sentences are produced by the propaganda and indoctrination of people manipulating my mind since 1987, hence, I cannot be held responsible for this post\'s content - me

    www.elhalf.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •