fatal error LNK1104: cannot open file 'boost_serialization.lib' - c++

I made a Qt application using boost serialization that builds perfectly on MacOS and Linux. Now I'm trying to build it on Windows using MSVC 2010.
I'm using Qt5.5.0 msvc2010, boost 1.55.0 msvc2010 binaries downloaded from sourceforge.
The serialization shared libraries that I have are:
boost_serialization-vc100-1_55.dll
boost_serialization-vc100-1_55.lib
boost_serialization-vc100-gd-1_55.dll
boost_serialization-vc100-gd-1_55.lib
boost_serialization-vc100-mt-1_55.dll
boost_serialization-vc100-mt-1_55.lib
boost_serialization-vc100-mt-gd-1_55.dll
boost_serialization-vc100-mt-gd-1_55.lib
There is no boost_serialization.lib.
In the .pro file I defined the boost macro:
DEFINES += BOOST_ALL_DYN_LINK
and I'm linking the library in this way:
LIBS += -L"$$PWD/../libs/boost-1.55.0/windows/lib" -lboost_serialization
but I still get the error.
I don't know how to solve this problem.
Any idea?

Related

Dynamically linked FFTW library to Qt5 Project fails when I build it

Details about my setup: Using a Qt Mingw64 Build with .lib files for 64-bit machine generated per the FFTW instructions: http://www.fftw.org/install/windows.html using Visual Code 2019. Made sure to download the pre-compiled 64-bit DLLs to generate the .lib files.
This excerpt of the .pro file was generated by Qt Creator's Add Library tool:
win32: LIBS += -L$$PWD/fftw/ -llibfftw3f-3
INCLUDEPATH += $$PWD/fftw
DEPENDPATH += $$PWD/fftw
In .CPP where I want to use FFTW library:
#include <fftw3.h>
What is in $$PWD/fftw:
libfftw3f-3.lib
libfftw3f-3.dll
libfftw3f-3.def
libfftw3f-3.esp
fftw3.h
Other misc. files included in FFTW 3.3.5 Precompiled DLL .zip
Where it fails: When I try to build it I get
"error: undefined reference to `__imp_fftw_malloc'"
and more similar errors based on the methods I'm calling from the FFTW library but fails at build.
Qt Creator auto-completes the methods so it seems to be linking the FFTW library correctly.

Error Using boost ASIO library compiled by Mingw 5.3 using QT

I compiled boost library using Mingw 5.3 comes with QT5.10.0 using this command
bootstrap gcc
b2 toolset=gcc
then I test some of its libraries as date time and file system and it worked fine. now I want to try to use the network library asio, so I linked that library using QT, by add library from right click on the project -> add library I add those
boost.regex
boost.system
boost.thread
boost.date_time
which comes in the boost documentation to link that library to use asio library here
I got this error when i make a simple hello world app contains only the header
#include <boost/asio.hpp>
when i compiled i got this error.
D:\Build\boost_1_66_0\stage\lib\libboost_system-mgw53-mt-x32-1_66.a(error_code.o):-1: error: duplicate section `.rdata$_ZTIN5boost6system14error_category12std_categoryE[__ZTIN5boost6system14error_category12std_categoryE]' has different size
D:\Build\boost_1_66_0\stage\lib\libboost_system-mgw53-mt-x32-1_66.a(error_code.o):-1: error: duplicate section `.rdata$_ZTVN5boost6system14error_category12std_categoryE[__ZTVN5boost6system14error_category12std_categoryE]' has different size
: error: undefined reference to `_imp__WSACleanup#0'
: error: undefined reference to `_imp__WSAStartup#8'
: error: ld returned 1 exit status
also i got some failed and skipped after I finish compiling boost library using Mingw 5.3.0 which comes with QT. so I don't know if these affect my build to use asio and I test each library alone such as date and time regex and file system which needs system library and all worked. but boost thread give me the error of duplicated section like the above error
Thanks in advance
You need to build with some additional libraries for Windows.
Try adding the following lines to your .pro file:
LIBS += -lgdi32
LIBS += -lwsock32
LIBS += -lws2_32
There are a couple of .pro files that build boost asio HTTP servers and clients on Windows with MinGw 5.3 from Qt here.

Including ffmpeg in qt project on windows causes the program to unexpectedly finish

I am trying to include ffmpeg in my qt project on windows. I am running QT4 and compiling with microsoft visual compiler 2010 on 32 bit windows 7. I am trying to include ffmpeg 2.8 which I got the dev and shared downloads from zeranoe. When I run it I get the following output:
Starting (executable path)...
The program has unexpectedly finished.
(executable path) exited with code -1073741819
I am able to produce this output with the following:
ffmpeg_test.pro:
QT += core
TARGET = ffmpeg_test
INCLUDEPATH += (ffmpeg dev path)/include
LIBS += -L(ffmpeg dev path)/lib
LIBS += -lavformat
SOURCES += main.cpp
main.cpp:
extern "C"
{
#ifndef __STDC_CONSTANT_MACROS
#define __STDC_CONSTANT_MACROS
#endif
#include <libavformat/avformat.h>
}
int main(int argc, char *argv[])
{
av_register_all();
return 0;
}
I have put the .dll files from the ffmpeg share bin into the same folder that QT builds ffmpeg_test.exe into. I have also confirmed that they are found using dependency walker which shows a question mark when they are not in that directory and the avformat-56.dll file path when they are (the fact that the .dll files are found does not effect the output of the program).
Dependency walker does reveal that something weird is going on as there are no expected functions, but the functions found in avformat-56.dll look correct. I also have ran Dumpbin.exe /EXPORTS on avformat.lib and it also looks fine (I can post output if it would be helpful). It is worth noting that I have included this version of ffmpeg in a different application on this machine, it was not a qt project however. That project generated its make file with CMake rather than QMake and was built with Microsoft Visual C++ 2010 rather than QT Creator.
I have also included other .lib/.dll pairs in qt and they have no problems. I am noticing two differences from those pairs. First in the ffmpeg-dev lib folder instead of having only .lib files (as is the case for all my other .lib/.dll pairs) I also have a .def and a .dll.a file for each library. Second ffmpeg is a c library whereas all my other included libraries are c++.
update 3/29:
I have tried replacing the LIBS lines in my .pro with both of the following:
LIBS += (ffmpeg dev path)/lib/avformat.lib
LIBS += (ffmpeg dev path)/lib/libavformat.dll.a
Both give the same error message. I have also tried adding the following to my .pro file also with no effect.
DEFINES += __STDC_CONSTANT_MACROS
QMAKE_CXX_FLAGS += -D_STDC_CONSTANT_MACROS
Additionally I tried adding #define inline __inline to main.cpp as suggested on the ffmpeg website. Any ideas of things to try would be hugely appreciated!
update 3/31:
I have tried to start over with a new Windows build environment but the result remains unchanged with the test code above. (The new environment was able to run a hello world program).
My process for setting up this environment was to install a fresh version of 32 bit windows 7. Install Visual C++ 2010 Express from the Visual Studio 2010 Express All-in-one ISO. Install Qt 4.8.6 for 32 bit windows and Visual Studio 2010. And finally install Qt Creator 2.5.2. To set up Qt creator I went under tools->options and told it where to find the Qt 4.8.6 qmake. I downloaded the dev and shared builds for ffmpeg 2.8 from Zeranoe. I was missing stdint.h and inttypes so I downloaded them and put the files in /include/libavutil. Then I corrected any of the header files that complained from to "stdint.h" ect. I then put the dll files from ffmpeg-2.8-win32-shared/bin into the folder where qt was building ffmpeg_test ffmpeg_test-build-desktop-Qt_4_8_6__4_8_6__Release/release.
The problem is that ffmpeg was compiled with the MinGW compiler and sometimes libraries compiled with different compilers may not always be compatible. I was able to make my test program run correctly by getting the MinGW compiler and setting up Qt for MinGW. Also my version of ffmpeg did not require the changes involving stdint.h or inttypes.h. How this version of ffmpeg was able to compile using MSVC and cmake is still a mystery to me. For a path forward the question is if switching to the MinGW compiler is a option or if I need to compile ffmpeg for MSVC.

Crosscompiling my Linux QT Project with MXE fails. Library not found

I have a QT5 Project on Linux using taglib. It compiles fine inside QtCreator and runs flawless under Linux.
Now I want to Crosscompile the code using MXE. I've downloaded and "installed" MXE according the docs. I did a "make" for making all libraries crosscompiled. I also set my PATH as described in the docs.
the qmake run makes no errors, but when i "make" the project, the compiler complains:
./tagprocessortaglib.h:12:21: fatal error: fileref.h: No such file or directory
#include <fileref.h>
^
compilation terminated.
fileref.h is one of the library headers used by taglib, its furthermore the first of 3 includes of that lib.
In my .pro file, this two lines were added by QtCreator as i included the library for linux:
unix: CONFIG += link_pkgconfig
unix: PKGCONFIG += taglib
Are there any configurations to do for the library that I've missed? Any help is welcome! Thanks in advance!
Solved the issue:
I applied the Solution posted here: Compiling QT project for win32 target on Linux PC with larmadillo
and added the path to the library, this works for the MXR compiler run, but i have to remove it before native compiler runs.

naming convention not applied for boost libraries when built using VS2010

I just built Boost 1.54 using Visual Studio 2010. I am trying to link the built libs into my program and I am facing an issue there. The built libraries do not follow the Boost naming convention. For example, I have boost_atomic.lib instead of libboost_atomic-vc100-mt-1_54.lib
. When linking my program, VS errors out with the following error:
LINK : fatal error LNK1104: cannot open file
'libboost_atomic-vc100-mt-1_54.lib'
I checked my VS project and I do not refer to this anywhere. How do I fix this? Is there a flag that will generate Boost libs with the naming convention? If yes, I can rebuild boost. If not, how do I tell Boost to pickup the libs I have?
P.S: I did try adding boost_atomic.lib to additional libraries, but it keeps asking for that specific lib( I have defined BOOST_SP_USE_PTHREADS)