By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,820 Members | 1,187 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,820 IT Pros & Developers. It's quick & easy.

cygwin and visual studio.

P: n/a
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?


Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
> How do I resolve the conflict between
the two systems?


Use Emacs.

Jack

Jul 19 '05 #2

P: n/a
Hi JustSomeGuy,

"JustSomeGuy" <no**@nottelling.com> 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.


Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.