[AGENT++] Compiling the SNMP++ library using QT and QT Creator

Parker userqt at gmail.com
Wed May 27 14:08:45 CEST 2009


Hello, 
I want to share my experience with compiling SNMP++ using QT and QT Creator. 
I succeeded compiling it, but there were several problems and I'm not sure if my solution is correct. 

I have removed the SNMPv3 support and tried to compile it, because I don't need SNMPv3. 


But I got bunch of errors saying that the gethostbyname_r function could not be found 
and 
the inet_aton also in address.cpp .
----------------------------------------------------------------------------------------------     this is regarding  gethostbyname
I looked in the config file and saw 

// can we use the reentrant version of these functions or
// are the standard functions thread safe

#ifdef __GNUC__

#define HAVE_GETHOSTBYNAME_R

#define HAVE_LOCALTIME_R

#define HAVE_GETHOSTBYADDR_R





and it says that if GNUC is defined, I have this function. And this function is from the <netdb.h> which is included to address.h only if __unix is defined. 



#ifdef __unix

...

#include <netdb.h>

...

#endif



Yes, but QT is using mingw, which "is a port of the GNU Compiler Collection (GCC)" . So, I'm using GNUC but I don't use UNIX. 

---------------------------------------------------------------------------------------------- this is regarding inet_aton



so I removed 



#define HAVE_GETHOSTBYNAME_R

#define HAVE_LOCALTIME_R

#define HAVE_GETHOSTBYADDR_R 









Regarding the inet_alon : 



// We have inet_aton() function if not compiling with VC++ or Borland C++

#ifndef _MSC_VER

#ifndef __BCPLUSPLUS__

//#define HAVE_INET_ATON

#endif

#endif





I removed it and also I removed the thread support. 

#define _NO_THREADS







and I started compiling again. New error :  m_hThread in uxsnmp.cpp is undeclared. I looked it in the header and saw the following lines : 



#ifdef _THREADS

#ifdef WIN32

HANDLE m_hThread;

HANDLE m_hThreadEndEvent;





OK, so I need to define THREADS in order for my program to compile. And it compiled. 

So, please, someone tell me if this solution is appropriate and IF NOT, please, tell me what I have to do in order to not mess something. 

Thank you in advance ! 



p.s.: I don't have much experience with C++, but I have read a book about it. 



Best regards, 

Patric







__________ Information from ESET NOD32 Antivirus, version of virus signature database 4098 (20090522) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com




More information about the AGENTPP mailing list