HOWTO: snmpdemoapp on windows with MinGW and Code::Blocks

Jan Costermans <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
After a lot of searching, reading, trying, ... . I finally managed to get the
snmpdemoapp compiled using Code::Blocks (with MinGW) on Windows XP.

Here are the steps I followed. I hope they can be usefull for other peeps.
And maybe I can even get some suggestions back on how to improve this set-up
(since I'm a noob in compiling C code)

- I'm running WinXP SP2
- will use NET-SNMP v 5.7.1

STEP1: download and install mingw (mingw-get-inst-20111118.exe) and select to
install MSYS with it. I installed to c:\MinGW.

STEP2: donwload and extract net-snmp-sources. E.g. to c:\sources

STEP3: run MSYS. It's over here:   c:\MinGW\msys\1.0\msys.bat

STEP4: mount the directory with the net-snmp sources ( mine is c:\sources )
like so:  mount c:/sources /sources   NOTICE THE SLASH is a / here !!

STEP5: now cd /sources and follow the README.Win32 instructions:
    BASEDIR=c:/usr
    ./configure --prefix="$BASEDIR" --with-mibdir="$BASEDIR/share/snmp/mib"
--with-mib-modules="agentx disman/event-mib winExtDLL examples/example"
--disable-embedded-perl --without-perl-modules
    MAKE
    MAKE INSTALL
    ( ... takes a while to compile ... )
When it's done you can exit msys.

STEP6: install Code::Blocks (if it isn't installed yet) and start a new
project. E.g. c:\DEMO\DEMO.cbp

STEP7: change Code::Blocks settings>compiler and debugger (in the menu)
    7.1 tab toolchain executables
        - c compiler:                   gcc.exe
        - linker for dynamic libraries: gcc.exe
        - linker for static libraries:  ar.exe
        - debugger:                     gdb.exe
    7.2 tab linker settings
        Add all *.a files from C:\MinGW\lib\ to the path

STEP8: I like to copy all header files and static libraries to the project
folder. So copy c:\usr\include\net-snmp to c:\DEMO\net-snmp and c:\usr\lib
to c:\DEMO\lib

STEP9: Add the net-snmp headers and libraries to the project. In the menu
select: Project>Build options. 
    9.1 Go to Linker settings and add all static libraries from c:\demo\lib
    9.2 Go to search directories and add the directory c:\demo to the search
directories for compiler *and* linker

STEP10: Add snmpdemoapp.c to the Code::Blocks project and compile.

NOTE1: if not yet available you may need to download msvcr70.dllm to your
C:\WINDOWS

------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
signature.asc (application/pgp-signature, 490 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iQEcBAEBAgAGBQJPOW/GAAoJEKfmGrSKS09pirEIAKjvyaTEFHa6HbGwmaET9dAf
x7LDLWvaEm3rpqL3j9MLS+jbf7O1IoLk4JyuvEZ582CE4M25KiVOd4UHyYj4/OxM
ONuxPAQBDPhMY0PDS2RZIuWGTNqU0xCXoj8mQgYHqTZ9jo7XT4GwA1jGLRquI0In
sTDe6GzXKX72pPVNRgsgUHFHJOurcKq0QoO25P/b2CnfwXQz4kxYKe6cBZiJmchC
dgcdjajRzKf3rZgVvZEwsNDX6NqhwDpLATsIA49ZQYDNYuYs6AXYkVtOpWb2Yrsr
wcEXyDtZv9fZ7XnUZDFVklqRMcNMZiPSMnIGoUdQPi+0zHdLv+saAVqh6QP+tGI=
=FsjH
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.