win下snmp++编译手记

转载注明原出处
http://blog.csdn.net/yp541118319/article/details/65628175

snmp++

下载

http://www.agentpp.com/download.html#SNMP_PP

SNMP++ 3.3.7
LIBDES-l-4.01a
MS VC++ 12 Project Files for SNMP++ 3.3.1/AGENT++ 4.0.2 or later

解压参考

README WIN32

The Visual Studio 2013 project files require that the libdes, SNMP++,
AGENT++, and/or AgentX++ sources are extracted in the same directory
as the Visual Studio project files. The directory structure should
then look like (note: there must not be any version numbers in the
directory names):

common-root-dir |– libdes |– snmp++ |– agent++ |– agentx++
|– vs2013

Make sure, that you delete the file config_snmp_pp.h from the
snmp++\include\snmp_pp directory. Otherwise, the linked programs crash
on execution, because the different projects might have used different
versions of the config_snmp_pp.h file.

The file with the right (default) settings for the WIN32 platform is
located in vs2013\SNMP++\include\snmp_pp and included from there by
the VS project files.

To build the libraries, use this order:

  1. libdes (or openssh)
  2. SNMP++
  3. AGENT++
  4. AgentX++

VS新建解决方案

修改相应的工具集(Platform Toolset),VS2013–v120,VS2010–v100
修改相应的字符集(Character Set),Use Multi-Byte Character Set

增加预处理宏

HAVE_CONFIG_H;_CRT_SECURE_NO_WARNINGS;

增加头文件目录

$(SolutionDir)\..\..\snmp++\include;$(SolutionDir)\..\..\snmp++;$(SolutionDir)\..\..\libdes;

包含文件






































































修改代码

    //auth_priv.cpp(855) 修改
    if (add_auth(new /*AuthSHA*/AuthMD5()) != SNMP_ERROR_SUCCESS)

    //log.h(38)增加
    #include 

    //config_snmp_pp.h(74) 修改
    #if 0
    #define HAVE_LIBSSL 1
    #endif
    #if 0
    #define HAVE_LIBTOMCRYPT 1
    #endif
    #if 1
    #define HAVE_LIBDES 1
    #endif
    #if 0
    #define HAVE_PTHREAD 1
    #endif

拷贝文件

源 \vs2013\SNMP++\include \config.h
源 \snmp++\libsnmp.h
目标目录 \snmp++\include\

使用lib

预定义宏

#define HAVE_CONFIG_H

头文件目录

$(SolutionDir)\include;$(SolutionDir)\..\..\libdes;$(SolutionDir)\..\..\snmp++\include;

头文件

#include 
#include "snmp_pp/snmp_pp.h"

依赖库目录

$(SolutionDir)\..\libdes\$(Configuration);$(SolutionDir)\$(Configuration);%(AdditionalLibraryDirectories)

添加依赖库

libdes.lib;SNMP++.lib;Ws2_32.lib;

附:libdes

VS新建解决方案

修改相应的工具集(Platform Toolset),VS2013–v120,VS2010–v100
修改相应的字符集(Character Set),Use Multi-Byte Character Set

直接编译即可使用

你可能感兴趣的:(网络协议)