cygwin and visual studio.

Discussion in 'C++' started by JustSomeGuy, Nov 13, 2003.

  1. JustSomeGuy

    JustSomeGuy Guest

    I'm writing a socket class using unix flavor sockets. I'm developing on
    win2k with M$ visual studio 6.0.
    I have cygwin installed and would like to use its socket header files:

    #ifdef UNIX
    #include <sys/types.h>
    #include <sys/socket.h>
    #include <netinet/in.h>
    #else // Windows.
    #include </cygwin/usr/include/sys/types.h>
    #include </cygwin/usr/include/sys/socket.h>
    #include </cygwin/usr/include/netinet/in.h>
    #endif

    Now MS has types defined so I've made sure that the cygwin types is used.

    My question is:
    1) Should I have simply set up an include search path to cygwin for
    types.h,socket.h and in.h?
    2) cygwin includes _ansi.h which is also in /cywin/user/include so I guess i
    need that in my include search path. How do I resolve the conflict between
    the two systems?
     
    JustSomeGuy, Nov 13, 2003
    #1
    1. Advertising

  2. JustSomeGuy

    Jack Adam Guest

    > How do I resolve the conflict between
    > the two systems?


    Use Emacs.

    Jack
     
    Jack Adam, Nov 13, 2003
    #2
    1. Advertising

  3. Hi JustSomeGuy,

    "JustSomeGuy" <> schrieb im Newsbeitrag
    news:wASsb.383779$pl3.349141@pd7tw3no...
    > 2) cygwin includes _ansi.h which is also in /cywin/user/include so I guess

    i
    > need that in my include search path. How do I resolve the conflict

    between
    > the two systems?


    The best solution would be to use Cygwin's C++ Compiler (GCC, "g++" command,
    use the Cygwin command line window to compile).

    Using Visual C++ with the Cygwin libraries and includes might not work
    (since they're designed for GCC). The Visual C++ linker does understand the
    UNIX library formats, however. In your project settings or compiler/linker
    command line options, you have to turn off default library and include path
    search and point those to Cygwin's directories.

    Another option is to use the WinSock1 interface (declared in WinSock2.h,
    documented in the Windows API documentation that came with Visual C++ or in
    the Platform SDK). It is roughly compatible with the UNIX interfaces, might
    require some conditional code though, especially select() calls are handled
    a bit differently than on UNIXes. This way, there'd be no need to use the
    Cygwin libraries or includes.

    I hope that helps.

    Regards,
    Ekkehard Morgenstern.
     
    Ekkehard Morgenstern, Nov 13, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wh
    Replies:
    2
    Views:
    532
    Cowboy \(Gregory A. Beamer\)
    Jan 16, 2004
  2. Thirumalai
    Replies:
    0
    Views:
    679
    Thirumalai
    May 22, 2006
  3. rockdale
    Replies:
    1
    Views:
    621
    Juan T. Llibre
    Aug 23, 2006
  4. xman
    Replies:
    0
    Views:
    517
  5. xman
    Replies:
    1
    Views:
    617
    Victor Bazarov
    Aug 17, 2005
Loading...

Share This Page