I got a pretty simple project that uses Qt as well as FFmpeg that i developed under linux.
Now I'am having trouble cross compiling said project with MXE to use it on a windows machine.
Under linux everything i had to do was adding
LIBS += -lavcodec -lavformat -lswscale -lavutil
to Qt's .pro file and wrap the includes for FFmpeg in an "extern "C"" block and it compiles just fine.
Now for MXE i just cloned the git repo and used
make MXE_TARGETS='x86_64-w64-mingw32.static' qt5 ffmpeg
As the MXE doc states i set the PATH variable and used
qmake && make
But i get a lot of undefined reference errors regarding libavformat.
Can anybody tell me what i am doing wrong here? I'm kinda lost.
Okay so I got this working.
The mxe version of gcc requires you to include the library multiple times if it is referenced by a library after it in the list of libraries to link.
Add -lavformat to the end of the LIBS line.
Related
I have a Qt project develop on linux, but now I need to compile on windows. I'm having a couple of problems in the migration process.
The first error I'm getting it's:
C:\Qt\Qt5.5.1\Tools\mingw492_32\i686-w64-mingw32\include\c++\bits\c++0x_warning.h:32: error:
#error This file requires compiler and library support for the ISO C++ 2011 standard.
This support is currently experimental, and must be enabled with the
-std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support for the \
^
and this it's how I'm putting it in the .pro of my project
QMAKE_CXXFLAGS += -std=c++11
I also try with
CONFIG += c++11
but the problem continuous.
To give a little more of information, I'm using the MinGW compiler that the Qt Creator install and the extension of my Headers and Sources are: .H and .C (Just in case this have anything to do with the problem, because I've seen that Qt always uses .cpp)
What could be the cause of the problem ?? If something it's unclear or more information it's needed please let me know.
I solve the problem, for me it worked when I change the extension of my sources, I change .C for .cc
I have a problem with PCL: specifically I want to use it in the existing project with existing Makefiles. However, PCL is using CMake and I couldn't find how to add it to Makefile directly. Does anyone know how to do that?
First try to compile the one of the example provided in PCL website using CMake.
http://pointclouds.org/documentation/tutorials/pcl_visualizer.php
After compiling the above example, you will find various new files and a folder created by CMake in your directory.
Go to CMakeFiles/pcl_visualizer_demo.dir/ .
Open file named link.txt, which contains the terminal command which has various pcl(point cloud libraries) linked dynamically to the file.
command should look similar to the command shown below
/usr/bin/c++ -O3 -Wno-deprecated -s CMakeFiles/pcl_visualizer_demo.dir -o pcl_visualizer_demo -rdynamic -lpcl_common -Wl,-Bstatic -lflann_cpp_s -Wl,-Bdynamic -lpcl_kdtree -lpcl_octree -lpcl_search -lqhull -lpcl_surface -lpcl_sample_consensus -lpcl_io -lpcl_filters -lpcl_features -lpcl_keypoints -lpcl_registration -lpcl_segmentation -lpcl_recognition -lpcl_visualization -lpcl_people -lpcl_outofcore -lpcl_tracking /usr/lib/libvtkGenericFiltering.so.5.8.0 /usr/lib/libvtkGeovis.so.5.8.0 /usr/lib/libvtkCharts.so.5.8.0 /usr/lib/libvtkViews.so.5.8.0 /usr/lib/libvtkInfovis.so.5.8.0 /usr/lib/libvtkWidgets.so.5.8.0
You can include these libraries in your Makefile directly.
If you use different functions or pcl headers files, then first try compiling it using CMake and get the libraries linked and add it to your Makefile of previous project.
I tried this method for my project which worked perfectly fine. I tried pkg-config to link the libraries, which didn't work in my case. I was not able to find any other method that easily links all the required libraries.
I know, I dug the whole internet to find out what the problem is and nothing has been helpful so far.
I am on Windows 7, using:
Qt 4.8.3: https://download.qt.io/archive/qt/4.8/4.8.3/qt-win-opensource-4.8.3-mingw.exe
MinGW32 4.4.0: http://nosymbolfound.blogspot.com/2012/12/since-until-now-qt-under-windows-is.html
I can compile any Qt demo example with Qt Creator, so I believe my system is working fine.
When trying to compile the program I ran into the well known issue:
g++ -enable-auto-import -o libqlcengine.a object_script.libqlcengine.Debug -L".\lib" -L"c:\Qt\4.8.3\lib" -lwinmm -L../../hotplugmonitor/src -lhotplugmonitor -lQtScriptd4 -lQtXmld4 -lQtGuid4 -lQtCored4
c:/mingw/bin/../lib/gcc/mingw32/4.4.0/../../../libmingw32.a(main.o):main.c:(.text+0x104): undefined reference to `WinMain#16'
(object_script.libqlcengine.Debug is a pretty long list of .o files)
Now, at that point of build it's trying to link a static .a library, so I see no reason for MinGW to look for WinMain. I did grep 'WinMain' and found no result on the entire source tree.
If you want to checkout the original sources:
svn co https://qlc.svn.sourceforge.net/svnroot/qlc qlc
Or my forked version:
git clone git://git.code.sf.net/p/qlcplus/code qlcplus-code
They have the same result.
Guys, what am I missing here ? I tried a whole bunch of C flags (-mwindows -lmingw32 -DQT_NEEDS_MAIN -lqtmain) but none worked.
Any magic please ?
P.S. Of course I can build on Linux either i386/amd64
SOLVED:
I just needed to add the following line to the .pro files where libraries were created:
win32:QMAKE_LFLAGS += -shared
[SOLVED]
I just figured out I needed to add the following line to the .pro files where libraries were created:
win32:QMAKE_LFLAGS += -shared
I've created a basic app in visual studio with Qt and an openGL widget. I export a .pro file from the addin so that I can compile in Linux.
I get the message:
/usr/bin/ld: cannot find -lopengl32
/usr/bin/ld: cannot find -lglu32
... when running make.
The issue goes away and the program compiles fine if I remove:
LIBS += -lopengl32 \
-lglu32
... from the generated .pro file.
I understand the "export .pro" feature is not flawless, but is this the correct way to fix this problem?
I don't quite remember the exact name of the OpenGL library on Linux, but it's not opengl32. Rather libopengl. So it's perfectly normal.
This will make you link with opengl32.lib on windows only:
win32 : LIBS += -lopengl32 -lglu32
and if needed, this will make you link with libopengl on Linux :
unix : LIBS += -lopengl -lglu
For the macx platform scope, I guess there is additional work to link with the OpenGL Framework.
I've successfully built a program that can read Mifare 1K Card using Qt on Linux. So now, I would like it to run on Windows. From what I've gathered, there's no PCSC-Lite port on Windows and I need to use winscard from Windows SDK. I've downloaded it and I got lots of undefined reference errors from my Qt in Windows (with MingW). For example:
release/ReadCard.o:ReadCard.cpp:(.text+0x48e): undefined reference to `pcsc_stringify_error'
release/ReadCard.o:ReadCard.cpp:(.text+0x5e9): undefined reference to `pcsc_stringify_error'
release/ReadCard.o:ReadCard.cpp:(.text+0x7ed): undefined reference to `pcsc_stringify_error'
release/ReadCard.o:ReadCard.cpp:(.text+0x2e56): undefined reference to `SCardListReaderGroups'
release/ReadCard.o:ReadCard.cpp:(.text+0x3adc): undefined reference to `SCardListReaders'
release/ReadCard.o:ReadCard.cpp:(.text+0x3cc6): undefined reference to `SCardListReaders'
release/ReadCard.o:ReadCard.cpp:(.text+0x3f88): undefined reference to `SCardGetStatusChange'
release/ReadCard.o:ReadCard.cpp:(.text+0x4274): undefined reference to `SCardConnect'
release/ReadCard.o:ReadCard.cpp:(.text+0x4d1b): undefined reference to `SCardGetStatusChange
I've also tried specifying these libraries in the project, but still failed.
LIBS += -lwinscard -lpcsclite WinSCard.Lib
Theoretically speaking, pcsc-lite is a port of Windows PC/SC stack to UNIX machines. Windows PC/SC implementation is the "reference implementation" which pcsc-lite mimics. Not all Windows SCard functions are implemented in pcsc-lite and there are even minor differences, documented in pcsc-lite documentation
Don't know about the Qt specifics, but some notes:
pcsc_stringify_error is a pcsc-lite specific function. It does not exist in Windows
there is no pcsclite library on Windows or mingw, so you probably need different build files for Windows.
have a look at OpenSC and how it makes use of PC/SC(-lite) and if you're building with mingw, have a look at the "build" project. internal-winscard.h from OpenSC might be of interest to you as well.
Except for the pcsc_stringify_error, your problems are with generic Windows linking and Qt (qmake?) build system.
It's been a while and I've managed to solve this using headers from the example that comes with my reader. My .pro file looks like this
win32 {
HEADERS += MainWindow.h \
ReadCard.h \
Config.h
INCLUDEPATH += C:/Omnikey/Include
LIBS += C:/Omnikey/Lib/winscardn.lib
}
unix {
HEADERS += MainWindow.h \
wintypes.h \
winscard.h \
reader.h \
pcsclite.h \
ReadCard.h \
Config.h
LIBS += -lpcsclite
}
I'm not sure if this solution can be used with other type of readers, but it sure solved mine.
i ran into the same problem, being unable to use winscard from the Windows SDK together with the minGW compiler.
A quick fix is to use the MSVC++ compiler (if you have access to it offcourse..) instead of minGW (you'll need to build Qt itself using the MSVC++ compiler also).
Probably its also possible to get this working with minGW but i didn't look into it any further..