Nmap Development mailing list archives

Re: Compiling Nmap on Visual C++ 2005 Express


From: Fyodor <fyodor () insecure org>
Date: Mon, 21 Nov 2005 19:22:14 -0800

On Mon, Nov 21, 2005 at 12:36:20PM -0500, kx wrote:
I was curious if anyone had successfully compiled Nmap on Visual C++
2005 Express using the Platform SDK. I am a Visual Studios novice, but
I thought if we could get Nmap compiling in Express, it would open up
Windows development to a lot of hobbyist programmers like myself, who
are just too cheap to buy the full version.

Neat!  I hadn't heard abou this (currently free) offering from MS.
The error you noted is:

Linking...
LIBCMT.lib(strnicmp.obj) : error LNK2005: __strnicmp already defined
in nbase.lib(strcasecmp.obj)
.\Release/nmap.exe : fatal error LNK1169: one or more multiply defined
symbols found

It is possible that this is a link order error, as you suggest.
Alternatively, maybe you just need to add:

#define HAVE_STRNCASECMP 1

to nbase/nbase_winconfig.h, then make clean and recompile.  It looks
like Windows already has a function like strncasecmp called
_strnicmp.  So nbase.h includes:

#define strncasecmp _strnicmp

But for some reason, HAVE_STRNCASECMP is not defined, so Nmap tries to
compile in its own strncasecmp().  strcasecmp.c includes:

#ifndef HAVE_STRNCASECMP
int strncasecmp(const char *s1, const char *s2, size_t n)

But that looks like it is being redefined to:

int _strnicmp(...

And so the linker gets confused because it sees the native _strnicmp()
and the one it compiled from strcasecmp.c.

Please let us know how this goes!

Thanks,
Fyodor


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev


Current thread: