I did my search everywhere I could and I still have multiple problems with static compilling Qt under Windows (8.1, x64). I've tried a couple of articles describing how to do this, the last one (How to compile Qt 5 under Windows or Linux, 32 or 64 bit, static or dynamic on VS2010, VS2012, VS2013 or VS2015 Express or g++) was apparenty the closest to my case, but it's still not perfect. After applying changes pointed out here (Build static Qt project with Visual Studio 2015) I had errores:
Error LNK2019 unresolved external symbol gethostname referenced in function "public: static class QString __cdecl QSysInfo::machineHostName(void)" (?machineHostName#QSysInfo##SA?AVQString##XZ)
Error LNK2019 unresolved external symbol WSAStartup referenced in function "public: __cdecl QWindowsSockInit::QWindowsSockInit(void)" (??0QWindowsSockInit##QEAA#XZ)
Error LNK2019 unresolved external symbol WSACleanup referenced in function "public: __cdecl QWindowsSockInit::~QWindowsSockInit(void)" (??1QWindowsSockInit##QEAA#XZ)
Error LNK2019 unresolved external symbol WSAAsyncSelect referenced in function "public: void __cdecl QEventDispatcherWin32Private::doWsaAsyncSelect(int,long)" (?doWsaAsyncSelect#QEventDispatcherWin32Private##QEAAXHJ#Z)
which were gone after including ws2_32.dll from Windows SDK. Ok, I'm able to run my project inside my Visual Studio now, but I can't run the exe-file (which was the original point of static linking) because of the following error:
This application failed to start because it could not find or load the Qt platform plugin "windows" in "".
Can somebody please help me? I spent several days trying to figure this out.
I'm trying to build Crypto++ 5.6.2 in for Qt with Visual Studio 2013, but its producing errors. Here is what I've done so far.
Downloaded Crypto++ 5.6.2
Downloaded vs2010.zip and vs2010-dynamic.zip and overwrite the exiting project files.
The page says this about vs2010-dynamic.zip, but the ZIP includes only cryptest.sln for VS2005. Just a single file. But anyway, I used the file:
archive of a pre-converted solution file, project files and filters for Visual Studio 2010 and above."
I then:
Opened cryptest.sln in MSVC2013, and set "Multi-threaded DLL (/MD)" for each project (project --> properties --> C/C++ --> Code Generation --> Runtime Library --> /MD)
Build --> 'Batch Build' --> Check cryptdll, cryptest, cryptlib, dlltest (Release|win32) --> Build
It resulted in a DLL and LIB in DLL_Output directory. I then:
Moved the DLL to the directory where Qt executable resides.
In Qt, I added two lines to test.pro:
INCLUDEPATH += "../extern/msvc2013/cryptopp562/include"
LIBS += -L"..\extern\msvc2013\cryptopp562\include\cryptopp\Win32\DLL_Output\Release" -lcryptopp
But in Qt, I've got the following errors:
mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::GetCurrentTimerValue(void)" (?GetCurrentTimerValue#ThreadUserTimer#CryptoPP##UAE_KXZ)
mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::TicksPerSecond(void)" (?TicksPerSecond#ThreadUserTimer#CryptoPP##UAE_KXZ)
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "class CryptoPP::NameValuePairs const & const CryptoPP::g_nullNameValuePairs" (?g_nullNameValuePairs#CryptoPP##3ABVNameValuePairs#1#B) referenced in function "public: __thiscall CryptoPP::HMAC::HMAC(unsigned char const *,unsigned int)" (??0?$HMAC#VSHA256#CryptoPP###CryptoPP##QAE#PBEI#Z)
release\user_account_registration.exe:-1: error: LNK1120: 3 unresolved externals
Do you have any ideas why I am getting the errors?
Any help/comment/insight would be really appreciated.
mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::GetCurrentTimerValue(void)" (?GetCurrentTimerValue#ThreadUserTimer#CryptoPP##UAE_KXZ)
mainwindow.obj:-1: error: LNK2001: unresolved external symbol "public: virtual unsigned __int64 __thiscall CryptoPP::ThreadUserTimer::TicksPerSecond(void)" (?TicksPerSecond#ThreadUserTimer#CryptoPP##UAE_KXZ)
mainwindow.obj:-1: error: LNK2019: unresolved external symbol "class CryptoPP::NameValuePairs const & const CryptoPP::g_nullNameValuePairs" (?g_nullNameValuePairs#CryptoPP##3ABVNameValuePairs#1#B) referenced in function "public: __thiscall CryptoPP::HMAC::HMAC(unsigned char const *,unsigned int)" (??0?$HMAC#VSHA256#CryptoPP###CryptoPP##QAE#PBEI#Z)
If you look at the source code for hrtimer.h, ThreadUserTimer is missing CRYPTOPP_DLL. That means the DLL does not export ThreadUserTimer (and many other classes).
In general, you should avoid the FIPS DLL unless you have a hard requirement to do so. Its special purpose, and its not easy to work with. It also has Operational Environment requirements from FIPS 140-2. I doubt you want to limit yourself to Visual Studio 2005 and Windows Server 2003.
If you insist on using the FIPS DLL, then you need to link against the DLL as expected. "As expected" means you use the cryptopp.lib import library at compile/link time; and cryptopp.dll at runtime. You also have to link again cryptlib.lib to get the missing classes, like ThreadUserTimer, while setting CRYPTOPP_IMPORTS to avoid duplicate symbols when using both libraries.
Instead of using the DLL, download the updated (and fixed) vs2010-dynamic.zip. Use it to build the Crypto++ library and then use the static library. "Use the static library" means to link against cryptlib.lib only.
The project files from vs2010-dynamic.zip might reference some source files that you don't have because its built from the latest stable sources. If the source file is missing, then simply delete it from the project file. Off the top of my head, Crypto++ 5.6.2 should be missing HKDF, RDRAND, RDSEED, ChaCha, BLAKE2, Base64URLEncoder, Base64URLDecoder, etc. It also lacks the rename of bench.cpp to bench1.cpp.
The Visual Studio wiki page has more information on Windows project files and artifacts like cryptlib.lib.
INCLUDEPATH += ".../cryptopp562/include"
LIBS += -L"...\cryptopp562\include\cryptopp\Win32\DLL_Output\Release" -lcryptopp
I think you should use only -lcryptlib because its the static library, and it has everything you need. The path to the library is $(Platform)\Output\$(Configuration), but I don't know how to translate it into something QT composer can use.
Otherwise, I think you need to specify both -lcryptopp -lcryptlib, and add CRYPTOPP_IMPORTS to preprocessor definitions.
vs2010.zip, vs2010-dynamic.zip and vs2005-dynamic.zip are built from the latest GitHub sources. As of this writing (JUN 1 2016), that's effectively pre-Crypto++ 5.6.4. If you are using the ZIP files with a down level Crypto++, like 5.6.2 or 5.6.3, then you will run into minor problems.
There are two minor problems I am aware. First is a rename of bench.cpp to bench1.cpp. Its error is either:
C1083: Cannot open source file: 'bench1.cpp': No such file or directory
LNK2001: unresolved external symbol "void __cdecl OutputResultOperations(char const *,char const *,bool,unsigned long,double)" (?OutputResultOperations##YAXPBD0_NKN#Z)
The fix is to either (1) open cryptest.vcxproj in notepad, find bench1.cpp, and then rename it to bench.cpp. Or (2) rename bench.cpp to bench1.cpp on the filesystem.
The second problem is a little trickier because its a moving target. Down level releases, like 5.6.2 or 5.6.3, are missing the latest classes available in GitHub. They include HKDF (5.6.3), RDRAND (5.6.3), RDSEED (5.6.3), ChaCha (5.6.4), BLAKE2 (5.6.4), Poly1305 (5.6.4), etc.
The fix is to remove the missing source files from the Visual Studio project files since they don't exist for the down level releases.
Another option is to add the missing class files from the latest sources, but there could be complications. For example, many of the sources subtly depend upon the latest config.h, cpu.h and cpu.cpp. The "subtlety" is you won't realize you are getting an under-performing class.
An example of under-performing class is BLAKE2. config.h adds compile time ARM-32 and ARM-64 detection. cpu.h and cpu.cpp adds runtime ARM instruction detection. If you add BLAKE2 without the other files, then none of the detection occurs and you get a straight C/C++ implementation. The NEON implementation runs around 9 to 12 cycles per byte, while the C/C++ implementation runs around 40 cycles per byte.
I am using Qt for GUI and building my project in waf.
For switching to windows subsystem from console(default) i had to pass this argument to the VS linker throught my wscript(waf)
subsystem='windows'
i added this in build part for waf file and I am getting this error
MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
C:\cygwin\home\sobingt\project\build\src\View\app.exe : fatal error LNK1120: 1 unresolved externals
I want to run this program as windows not as console.The Code works if i run it as console
subsystem='console'
You need to link against qtmain.lib (IIRC). This provides a shim around winmain which you need for windowed windows apps.
I am working with a Qt based project in visual c++. Initially I installed Qt 4.7.3 and imported its libraries in visual c++. Everything was working fine. yesterday, I ran "configure" command on command on command prompt. After that I am receiving error messages while compiling the program.
So I uninstalled Qt 4.7.3 and installed 4.7.4 and configured again the libraries. But still I am receiving the same error messages.
Qwt.lib(moc_qwt_scale_widget.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QWidget::staticMetaObject" (?staticMetaObject#QWidget##2UQMetaObject##B)
1>Qwt.lib(moc_qwt_dyngrid_layout.obj) : error LNK2001: unresolved external symbol "public: static struct QMetaObject const QLayout::staticMetaObject" (?staticMetaObject#QLayout##2UQMetaObject##B)
1>..\Debug\project.exe : fatal error LNK1120: 9 unresolved externals
1>
Can anyone please help me in this issue.
Its a linker error.. you need to compile your headers that contain Q_OBJECT macro with moc compiler. Look at this guys solutions
Q_OBJECT Problem in Visual C++
I am trying to configure Qt using the OpenGL parameter for a custom WinCE SDK, but I get a compiler error. I found a similar error faced in the http://www.qtcentre.org/threads/37052-WinCE-OpenGL-ES-build-error?s=7aa5ac49753e1c3f1e0b624bb9134faa post.
The link says to install OpenGL SDK from Imagination Technology, link the library, and include the file to solve the error.
When I tried the mentioned steps, I got linker errors.
link /LIBPATH:"c:\Qt\4.7.4_2\lib" /LIBPATH:"c:\Qt\4.7.4_2\lib" /NOLOGO /
NODEFAULTLIB:OLDNAMES.LIB /DEBUG /SUBSYSTEM:WINDOWSCE,6.00 /MACHINE:THUMB /DLL /
SAFESEH:NO /VERSION:4.74 /OUT:....\lib\QtGuid4.dll #C:\DOCUME~1\VARUN~1.JAJ\LOC
ALS~1\Temp\nm8796.tmp
Creating library ....\lib\QtGuid4.lib and object ....\lib\QtGuid4.exp
qegl.obj : error LNK2019: unresolved external symbol __imp_eglBindAPI referenced
in function "public: bool __cdecl QEglContext::createContext(class QEglContext
*,class QEglProperties const *)" (?createContext#QEglContext##QAA_NPAV1#PBVQEglP
roperties###Z)
....\lib\QtGuid4.dll : fatal error LNK1120: 1 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\ce\bi
n\x86_arm\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 8\VC\BIN\n
make.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
Has anyone faced similar problems? Could you please suggest me what to do?