I am trying to create a Qt program that is able to control an Amptek 8000a MCA (a device that is connected via COM port for radiation detection purposes). The manufacturer provides c++, labview and vb API, but I am having a lot of trouble with Qt (C++) to recognise the dll. I have added the library using Qt's in-built add library function but I get lots of errors undefined reference to... e.g. error: undefined reference to PmcaPowerUp#4. The relevent part of my pro file looks like:
win32: LIBS += -L$$PWD/Libraries/ -lPMCADLL
INCLUDEPATH += $$PWD/Libraries
DEPENDPATH += $$PWD/Libraries
win32:!win32-g++: PRE_TARGETDEPS += $$PWD/Libraries/PMCADLL.lib
Can I use the .dll provided in the package above?
Do I have to compile it myself with mingw/qt?
It's giving me a lot of trouble when all you have to do with Matlab is loadlibrary('PMCADLL.dll','PmcaCom.h').
Done.
How I can get my project to link to the dll correctly or use mingw to compile the dll with the source files the manufacturer provides?
If a dll you have was generate on a platform or even with a compiler that is not compatable with your own you may (and would) have problems with it. So if you have a source code the best way is to compile a dll using it. Take a look at docs.
Related
I have an app wirtten with C++ (just simple QML loader) and QML (all GUI and logics).
Now I want to create some package for deployment to other systems. Currently I need it only for Windows so I create a package with Inno Setup.
I packaged my exe file and couple of Qt libraries. To view what libraries I need I used Dependency Walker. But I was surprized that my app was linked with unused libraries:
Qt5Multimedia.dll
Qt5MultimediaWidgets.dll
Qt5Sensors.dll
Qt5Positioning.dll
Also I see these libraries in compiler output: -lQt5Positioning -lQt5Sensors ... etc.
But I don't use no multimedia no sensors no positioning at all!!
In .pro file I use that:
QT += qml quick sql widgets xml webkitwidgets
So my qustion - how can I compile my app without these superfluous libraries?
i work on windows environment, i have installed QT creator recently and wanted to execute a c program from .c file in QT. There are couple of problems why the file does not compile, first it does not recognize the library headers "time.h" "math.h" and even "stdio.h"
Two, i'm not sure if it will compile even after fixing the library, because i changed the include path in the .pro file to the path of the libraries. and still had a proble of compilation.
Is there a way, that the compiler knows that the file is .c instead of c++...how can i proceed.
Thank you very much
It sounds like you installed the IDE but not the SDK. The SDK comes with gcc and the standard libraries that you are referring to. If you need to use your own separate compiler, you can configure it in Qt Creator > Tools > Options > Build and Run > Tool Chains.
Some additional information may be found here for your issue:
http://www.qtcentre.org/threads/33974-Compiling-c-files-using-C-and-QT
So, my suggestion is to download the full SDK of Qt, and then pick and choose the elements you want, and make sure it includes a compiler.
Hope that helps.
Hello i'm a young develop on Qt. I want to know that can we convert project Qt (header, source, form, resource) to a file can run without Qt Creator? And how can we convert it to a file executable on window (.exe)?
The compiler is responsible for making an executable out of the source code. This has nothing to do with Qt.
When you start a program from the QtCreator an executable file is built by the compiler, then started. Have a look in your project folder to find that .exe file.
You dont have to do anything special. Each Qt project has a .pro file that is used for compiling. You need to use qmake on the command line with the .pro file as input. This will generate a makefile that you can then give to nmake.exe (if using Visual Studio compilers) or mingw-make (if you are uisng mingw compilers) to build. These steps will compile your source code into the .exe. Look through documentation of qmake to know more. Qt Creator also does the same steps and you can check out the buildlog in Qt Creator to see it working.
Yes, the exe file that you compile with Qt Creator or alternatively some other IDE or compiler is technically all you need to run the project from there on, except you need to have the linked Qt libraries somehow available to the executable. This is especially important if you plan to run it on a machine different from the one you developed it on. See the Qt documentation on Deploying Qt Applications for other details you may need to consider in that case.
I want to use libspeex library in my nokia Qt application. How do I compile speex for this purpose, and how do i add it to my qt project?
Did you check the README file for Symbian?
If you manage to compile it, basically you just need to add a line like this in your .pro file:
symbian:LIBS += c:/path/to/library/speex.lib
(or whatever the resulting library is called).
What is the right way to build a library from source using MinGW and then reference it in the GUI application's project? I'm not familiar with gcc and makefiles, but I think there must be a utility which generates makefiles from existing source.
The library itself doesn't depend on anything except the standard C lib.
Thanks!
In the pro file write
LIBS += path/to/your/lib
This will add the reference to the static library. See the documentation.