[Qt-interest] How to compile the SNMP++ with QT and use it .

John McClurkin jwm at nei.nih.gov
Fri Apr 16 13:28:24 CEST 2010


jiangzhw2008 wrote:
You posted this message a few days ago and I answered but you seem not 
to have understood. So here goes again.
> 
> Hi all, please, help me with this task. I'm new to C++ and QT.
> I am design a Quantitative assessment of information security detection 
> system written with QT. I need a SNMP implementation library.
> I have chosen this one : 
> http://www.agentpp.com/snmp_pp3_x/download_snmp_ppv3/download_snmp_ppv3.html
> more specifically http://www.agentpp.com/snmp++v3.2.24.tar.gz 
> <http://www.agentpp.com/snmp++v3.2.23.tar.gz> this archive,
> 
> I am using Windows XP. The project is written in QT, my IDE is the QT 
> Creator1.3.
> 
> The SNMP lib that I gave you link for is just an archive with sources.
> 
> I've compile the libdes.a in the snmp++v3.2.24.tar.gz 
> <http://www.agentpp.com/snmp++v3.2.23.tar.gz> with QT creator 
> successfully,but failed in compiling the dll or lib of snmp++.

The Makefile included with this distribution generates a static library, 
not a shared library. Thelibdes.a is that static library. Files with 
.dll or .lib extensions are Visual Studio shared library file 
extensions. You don't need them when you use static libraries. Just link 
the libdes.a to your application.

While I
> compiled with VS2005 ,i got the libdes.lib and snmp++.lib,but when i 
> added these to the QT project,the QT couldn't recognized the function in 
> snmp++.
> 
> I googled much,it's said the dll compiled by msvc can not recognized by 
> QT for the different format of lib between them, I tried to add extern C 
> declartion and using pexports,dlltool to tranformate the lib but failed!

Of course you failed. As you found from Google, libraries compiled with 
Visual Studio can't be used with applications compiled with gcc. Adding 
extern declarations won't help.
But why are you doing this? Compile the library with QtCreator to get 
libdes.a, then compile the application with QtCreator and link in 
libdes.a. There is no need to use Visual Studio because you can't use 
.dll and .lib files produced by Visual Studio.

> 
> Is there a good way to solve this?
Yes, just use QtCreator.

Could someone be so kind to  give me a
> snmp++ example of QT4 (lib included)?
There are Qt examples in the distribution.

> I'm considering to construct a qt IDE in VS2005,would then the lib 
> compiled by msvc can recoginzed by this IDE?
I'm not sure what you mean by constructing a Qt IDE in Visual Studio, 
but you can use Visual Studio to build Qt applications. However, the 
distribution is geared towards gcc so this would be more work.

> 
> 
> Please, help me.
> 
> Best regards
> 
> P.S:QT 4.6  WindowsXP
> 
> 
> 



More information about the Qt-interest-old mailing list