Snmp++ Download

0 views
Skip to first unread message

Rosella Brain

unread,
Jul 31, 2024, 7:21:42 AM7/31/24
to stogazanwa

I need to create a basic program for work that utilizes the snmpget command. It needs to be usable in both windows and solaris as our clients use both. What's the best snmp library to use? I tried to download a number of them but I can't even get the sample programs that come with them to compile due to linker errors.

I know what snmp commands that I need to use, it's just a matter of getting a working library so that I can compile a C++ program that the clients could install to do an automatic diagnostic test rather than manually typing the commands at cmd prompt.

and I'm getting the error:
fatal error C1083: Cannot open include file: 'sys/time.h': No such file or directory
which from the research I've done (which only involved googling sys/time.h), it seems as though that's a unix header. Like I said before, this program needs to work in both Solaris and Windows but for now I'm just developing in Windows.

it does build on FreeBSD. and therefore should build on Solaris.
here is an extract of the make output.
as you can see from it, the Makefile does not have anything special.
are you using the wrong Makefile? or a different version of the library?

I'm really not sure to be honest. Here's the code that I'm using to try to test it. This code can be found in the rather outdated documentation for SNMP++. The OID and IP address are different in the documentation, but that shouldn't affect the compiling.

instead of -D__unix, you would probably require a -DWIN32 on windows. do you have it? and for lines like this one typedef SOCKET SnmpSocket; , you would probably need the platform SDK headers in your include path.

And as far as needing the Platform SDK headers in my include path, I set up the under Tools->Options->VC++ Directories->Include Files the directories linking to the include files in Visual Studio. Is this what you mean?

> Do you need makefiles for a windows platform?
you need some kind of a makefile. if you are using Visual C++, the project / workspace files also act as makefiles. you could set the preprocessor defines (WIN32 etc) in the project properties from the IDE. if you do not know how to do this, just add a #define WIN32 as the first line of the file you are trying to compile. before #include > And as far as needing the Platform SDK headers in my include path, I set up the under Tools->Options->VC++ Directories->Include Files the directories linking to the include files in Visual Studio. Is this what you mean?
yes, that should be fine then. but this

EDIT - I fixed the problem. I forgot I had turned off thread support in one of the config files because we didn't want this program flooding the network with snmp requests so there was no need for threads, but I just turned it back on and it compiled.


The thing that sucks is our hardware supplier is already working on a fix or diagnostic program (I'm not sure which) for the media convertors which is what I'm creating a program to test. But since I'm still in training, my manager just wants me to mess around and see if I can get something working to refamiliarize myself with C++ and networking even though they won't ever use it.

If it's just a "basic program" perhaps a scripting language like python might be a better fit. I've never used it but there is the PySNMP library. If you don't have python experience, I suggest you learn it. If you know C++, it should be easy to pick up. It's often much quicker and better suited for little problems like these.

Yeah, there was a really basic PERL script that another guy here wrote a few months back which did the general thing that was wanted but since I've never worked with PERL I thought porting the script to C++ might be an easier alternative. Are PERL scripts compatible with Solaris? If so, maybe I'll just bite the bullet and try to edit his code to make it more functional. I'm assuming you can still write things to a file and such in PERL?

But I would really look into learning python. It comes in really handy for tasks like these. Like I said, if you know C++, you can be writing python code in no time (hours even). Google uses it extensively.

I faced exactly the same problems discussed in the thread and followed the solutions. I could generate the snmp++.lib (in static) and snmp_pp.lib and snmp_pp.dll (in dynamic). I added them and compiled the sample program called ReceivedPower (the one mentioned in the thread) and it compiled successfully.

93ddb68554
Reply all
Reply to author
Forward
0 new messages