Nmap Development mailing list archives

Re: Compiling Nmap on Visual C++ 2005 Express


From: kx <kxmail () gmail com>
Date: Mon, 21 Nov 2005 23:36:45 -0500

That was the trick. It compiled, linked and ran, successfully on Windows SP2.

Here are the warnings of note:

.\nbase_rnd.c(166) : warning C4996: 'getpid' was declared deprecated
        ...VC\include\process.h(227) : see declaration of 'getpid'
Message: 'The POSIX name for this item is deprecated. Instead, use the
ISO C++ conformant name: _getpid. See online help for details.'

This C4996 warning was repeated throughout for the following function
declarations (I only listed one warning per declaration per source
file):
.\src\nsock_iod.c(97) : warning C4996: 'dup' was declared deprecated
.\winfix.cc(249) : warning C4996: 'stricmp' was declared deprecated
..\utils.cc(366) : warning C4996: 'write' was declared deprecated
..\utils.cc(487) : warning C4996: 'strdup' was declared deprecated
..\timing.cc(241) : warning C4996: 'strdup' was declared deprecated
..\targets.cc(1626) : warning C4996: 'strdup' was declared deprecated
..\TargetGroup.cc(167) : warning C4996: 'strdup' was declared deprecated
..\Target.cc(282) : warning C4996: 'strdup' was declared deprecated
..\service_scan.cc(857) : warning C4996: 'strdup' was declared deprecated
..\portlist.cc(279) : warning C4996: 'strdup' was declared deprecated
..\osscan.cc(1503) : warning C4996: 'strdup' was declared deprecated
..\NmapOps.cc(247) : warning C4996: 'strdup' was declared deprecated
..\nmap.cc(308) : warning C4996: 'strdup' was declared deprecated
..\main.cc(190) : warning C4996: 'getpid' was declared deprecated
..\main.cc(318) : warning C4996: 'putenv' was declared deprecated
..\main.cc(376) : warning C4996: 'open' was declared deprecated
..\main.cc(378) : warning C4996: 'dup2' was declared deprecated
..\idle_scan.cc(384) : warning C4996: 'strdup' was declared deprecated

.\src\nsock_connect.c(105) : warning C4267: 'argument' : conversion
from 'size_t' to 'int', possible loss of data

pcre_dfa_exec.c
.\pcre_dfa_exec.c(1427) : warning C4101: 'endcode' : unreferenced local variable
.\pcre_dfa_exec.c(1449) : warning C4101: 'is_repeated' : unreferenced
local variable

Very exciting that all looks good for now, and just some minor tidying
up to be done.

Cheers,
  kx


On 11/21/05, Fyodor <fyodor () insecure org> wrote:
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: