How to include Net-SNMP to QT project - qt

I'm trying to run this project:
https://github.com/vanhsati/SNMP-Monitor
Downloaded net-SNMP from:
https://sourceforge.net/projects/net-snmp/files/latest/download
I get a lot of errors when I try to build project.
Example code from official net-SNMP wiki also includes only two ".h" files.
How can I properly link the library to QT creator?

Related

Build .deb from Qt project

I have Qt project that want to create a .deb package. My project can be found here
I found 1 tutorial about it, it can compile but I need to activate some flag on pro file like CONFIG+=USE_LIBUSB, I don't know how to put those flag, because the tutorial is not fully explains.
Is there any tutorial how to build Qt project to .deb?

How to import open source projects into QT Creator 5.7?

I've been trying to import an open-source project into Qt-Creator to read the code and to learn from it by debuging. Unfortunatly I cannot build imported projects. I found two interessting projects:
https://sourceforge.net/projects/qpass/files/source/
and
https://github.com/keepassx/keepassx
I imported them into Qt Creator by File-->New File or Project-->Import Project-->Import as qmake Project (Limited Functionality). Afterwards I tried to run the project and I got an error:
G:\Qt Projekte\keepassx-2.0.3\src\autotype\test\AutoTypeTest.h:23: Fehler: autotype/AutoTypePlatformPlugin.h: No such file or directory
The file is definitely existing and it's within the project. I googled it and found that there might be problem when importing Qt4 projects into Qt5. Some user recommended to insert 'Qt += widgets' into the pro-File. But it didn't solve my problem.
Does anybody have an idea how to fix it? Is the way how I am importing projects into Qt Creator wrong?
Instead of "New File or Project", you want to use "Open File or Project". Since both projects use cmake, you should be opening their topmost CMakeLists.txt file. I've verified that both of the projects open that way on OS X with Qt/Creator from macports and build successfully using either the default CodeBlocks - Unix Makefiles CMake Generator, or CodeBlocks - Ninja.
Here are the things I had to do to get the builds going:
Add the macports binary path (/opt/local/bin) to the system environment in the project's build settings. That's so that cmake would find ninja. This is optional if you don't use ninja, but ninja speeds up builds by a good integer factors so it's recommended over make.
Add the /opt/local/include path to the INCLUDE_DIR path in QPass's CMakeLists.txt: otherwise it wouldn't find gcrypt's include files from macports. That wouldn't be a problem on most linux distributions, but you'd need a similar fix on windows.

Cannot find c:\Users\qt\work\install\lib\Qt5Widgetsd.lib when compiling QtWebEngine examples

I downloaded Qt5.6 VS2013 32bit and try to run the official example of QtWebEngine.
I just followed the instruction but
When linking it gives out an error of
LNK1104 file not found c:\Users\qt\work\install\lib\Qt5Widgetsd.lib.
However, I have no idea of where this path c:\Users\qt\work\install\lib\ comes from.
I did text search in all directories of example folder and no hits other than generated files(makefiles and pdbs).
I also checked system environment variables but no hits.
Furthermore, I checked Qt Creator'r Projects panel and its Build Environment and still no hits.
Did I miss something?
P.S. this error was given out by linking DemoBrowser example of QtWebEngineWidgets pro
The link is generated by qmake when it generates the build scrip from the qt project file (*.pro). It is based from the qmake application path that is generaly installed together with the libraries (check you qt kit setup to change it if needed: Jst browse to qmake.exe application).
Then try regenerate the build script. It should fix the issue.
You may also have issue with installation not being in debug mode; you are trying to use Qt5Widgetsd.lib library instead of the non-debug one Qt5Widgets.lib

Using Qt Installer Framework to create my Application Installer

I want to create an installer for my Application. So, I have read about Qt Installer Framework and I tested the tutorial example and create the installer and everything work find with the example. But I have a doubt when I try to do the same process for my Application. When I compile the code a folder is created at the same level of my code:
MyApplication (my code)
build-MyApplication-Desktop_Qt_5_4_1_MinGW_32bit-Release (code compiled)
So my questions are:
What files of the compilation do I need to copy into the folder myinstaller/packages/vendor/ recommended by Qt Intaller Framework?
If I have dependencies of Qt like serialport, multimedia, and others, how do I insert these dependecies with Qt Installer Framework?
windeployqt.exe is what you want. Just run that on the command line and give it your executable as the argument. It will automatically copy in all the required Qt libraries and even provide the runtime redistributable installer. Then you can use the binarycreator to generate an installer.
You can put all the dependencies in myinstaller/packages/vendor/data, along with your exe. and eventual additional files. I recommended using i.e. dependency walker for finding all the required dependencies. Some of the binarycreator tutorials on qt are outdated; make sure you use the command
<location-of-ifw>\binarycreator.exe -t <location-of-ifw>\installerbase.exe -p <package_directory> -c <config_directory>\<config_file> <installer_name>
with the appropriate arguments.

Linking netcdf library with Qt

I have a prebuilt version of netcdf Library which I've downloaded from the Unidata website,
Now I am trying to link this Library to Qt 5, to use it in my Qt project. So I looked for some solutions in the internet and I found that I should add these lines to my Project.pro :
LIBS += -LC:/netcdf/lib -lnetcdf
INCLUDEPATH += C:/netcdf/include
But after runing the project, it doesn't work, so I rerun it with the debuger and it shows me this Message Box (titled "executable Failed") : During startup program exited with code 0xc0000135
Please help !
The pre-built libraries are built using Microsoft Visual Studio. As I recall, the C/C++ compiler the Qt SDK uses on Windows is a mingw-variant of gcc. I am not certain if the pre-built netcdf libraries are compatible with the mingw runtime, but it is usually not a good idea to mix C runtimes anyways.
I'm assuming you are using Qt Creator; if so, then it may be easier than you think to compile the netcdf-c libraries yourself. Because the netcdf-c project uses CMake, you will be able to open it as a project in Qt Creator.
Prerequisites
You will need the following:
cmake: http://cmake.org
netcdf-c source code: http://github.com/Unidata/netcdf-c/releases
NetCDF Dependencies
Note that you will need to install the following dependencies first, depending on the functionality you want from the netcdf library.
NetCDF4 support requires libhdf5 and libhdf5_hl, both provided by the hdf5 package available from http://www.hdfgroup.org.
DAP support requires libcurl. Google should be able to help you find this.
If you do not need these capabilities, you'll be fine with a straight netcdf-classic install.
Opening netcdf-c as a project in Qt Creator
Launch Qt Creator
Go to file->open project
Navigate to the netcdf-c source directory and open the CMakeLists.txt file.
This will load the netcdf source as a new project in Qt Creator. At this point it should be pretty straight forward to compile netcdf and install it somewhere on your system to use with your project.
Incorrect Assumption
If my assumption that you are using Qt Creator is wrong, this is all still possible from the command line; it will be, however, a little more involved.

Resources