Qt 5 + MSVC2013 static external lib LNK2001 Windows API - c++

I've got following scenario:
Library that uses some Windows functions like RegOpenKeyExA aso (created and compiled with Visual Studio 2013 /MD)
Small console application created in VS2013 that uses the library (static linked; /MD). Building the console app works fine
Small Qt5 Gui app that uses the lib as well (static linked; Qt 5.3.1 with MSVC2013)
When I build the Qt app in Qt Creator I get following output:
10:39:52: The process "D:\Qt\Qt5.3.1\5.3\msvc2013\bin\qmake.exe" exited normally.
10:39:52: Starting: "D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe"
D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe -f Makefile.Release
link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /SUBSYSTEM:WINDOWS "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:release\TEST_app_Qt.exe.embed.manifest /OUT:release\TEST_app_Qt.exe #C:\Users\gortner\AppData\Local\Temp\TEST_app_Qt.exe.12772.63.jom
MyLib.lib(MyLib.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
LINK : warning LNK4098: defaultlib 'LIBCMT' conflicts with use of other libs; use /NODEFAULTLIB:library
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptAcquireContextW#20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptSetKeyParam#16
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegSetValueExA#24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegQueryValueExA#24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptReleaseContext#8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegOpenKeyExA#20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptImportKey#24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegDeleteValueA#8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptDestroyKey#4
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__GetUserNameA#8
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__CryptDecrypt#24
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__SHGetFolderPathA#20
MyLib.lib(MyLib.obj) : error LNK2001: unresolved external symbol __imp__RegCloseKey#4
release\TEST_app_Qt.exe : fatal error LNK1120: 13 unresolved externals
jom: D:\Development\build-TEST_app_Qt-Desktop_Qt_5_3_MSVC2013_32bit-Release\Makefile.Release [release\TEST_app_Qt.exe] Error 1120
jom: D:\Development\build-TEST_app_Qt-Desktop_Qt_5_3_MSVC2013_32bit-Release\Makefile [release] Error 2
10:39:52: The process "D:\Qt\Qt5.3.1\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project TEST_app_Qt (kit: Desktop Qt 5.3 MSVC2013 32bit)
When executing step 'Make'
10:39:52: Elapsed time: 00:01.
My .pro file:
#
# Project created by QtCreator 2014-09-01T11:10:50
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = TEST_app_Qt
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
mymath.cpp \
stdafx.cpp
HEADERS += mainwindow.h \
mymath.h \
targetver.h \
stdafx.h
FORMS += \
mainwindow.ui
INCLUDEPATH += $$PWD/inc
DEPENDPATH += $$PWD/inc
win32: LIBS += -L$$PWD/lib/ -lMyLib
#win32: PRE_TARGETDEPS += $$PWD/lib/MyLib.lib
QMAKE_CFLAGS_RELEASE -= -MT
QMAKE_CXXFLAGS_RELEASE -= MT
QMAKE_CFLAGS_RELEASE += /MD
QMAKE_CXXFLAGS_RELEASE += /MD
As mentioned above. When I use the lib in a VS project it works fine but in Qt i have troubles

If you look up the listed missing symbols in MSDN you will find that they are in Advapi32.lib. That import lib is not listed in the LIBS in your .pro file. Try adding the following:
win32: LIBS += Advapi32.lib

Related

build poco c++ library on windows

I'm trying to build poco library (c++) with openssl on windows 10 (VS 2012). With the following cmd file:
#echo off
set INCLUDE=c:\openssl\include
set LIB=c:\openssl\lib
set _IsNativeEnvironment=true
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" amd64
call "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\amd64\vcvars64.bat"
buildwin 110 build all release x64 nosamples notests devenv
I get link errors:
1>------ Build started: Project: Crypto, Configuration: release_shared x64 ------
1> Datei *.dll nicht gefunden
1> Datei *.lib nicht gefunden
1> Creating library ..\lib64\PocoCrypto.lib and object ..\lib64\PocoCrypto.exp
1>ECKey.obj : error LNK2001: unresolved external symbol EVP_PKEY_type
1>ECKeyImpl.obj : error LNK2001: unresolved external symbol EVP_PKEY_type
1>RSAKeyImpl.obj : error LNK2001: unresolved external symbol EVP_PKEY_type
1>PKCS12Container.obj : error LNK2001: unresolved external symbol EVP_PKEY_type
1>EVPPKey.obj : error LNK2019: unresolved external symbol EVP_PKEY_type referenced in function "private: void __cdecl Poco::Crypto::EVPPKey::newECKey(char const *)" (?newECKey#EVPPKey#Crypto#Poco##AEAAXPEBD#Z)
...
(Datei *.dll nicht gefunden == file *.dll not found).
If I remove the Crypto in file "components" (Is it OK if I want to use https?), I get the following error:
1>------ Build started: Project: NetSSL_OpenSSL, Configuration: release_shared x64 ------
1> Creating library ..\lib64\PocoNetSSL.lib and object ..\lib64\PocoNetSSL.exp
1>Context.obj : error LNK2019: unresolved external symbol BIO_new_file referenced in function "private: void __cdecl Poco::Net::Context::initDH(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?initDH#Context#Net#Poco##AEAAXAEBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
...
I installed openssl from "Shining Light" (win64). I also tried to use openssl which is built from source (https://github.com/pocoproject/openssl). But I get the same errors.
Can someone help me ?!
Thank you!
Xinyu
OK, If I delete all object files: folder obj64, including obj64 in testsuite, then every thing is ok.

Compiling dlib on Windows

I try to use dlib in Qt project on Windows. After downloading I at once started to try build my Qt application, without building examples. I also downloaded static libraries libpng and libjpeg from GnuWin.
.pro file:
SOURCES += main.cpp\
mainwindow.cpp \
C:/Users/user/Downloads/dlib-19.0/dlib-19.0/dlib/all/source.cpp
HEADERS += mainwindow.h
INCLUDEPATH += "C:\Users\user\Downloads\dlib-19.0\dlib-19.0"
LIBS += -L"C:\Users\user\Downloads\dlib-19.0\dlib-19.0"
INCLUDEPATH += "C:\Users\user\Downloads\dlib-19.0\dlib-19.0\dlib\external\libpng"
INCLUDEPATH += "C:\Users\user\Downloads\dlib-19.0\dlib-19.0\dlib\external\libjpeg"
LIBS += -L"C:\Users\user\Downloads\jpeg-6b-4-lib\lib" -ljpeg
LIBS += -L"C:\Users\user\Downloads\libpng-1.2.37-lib\lib" -lpng
LIBS += -lwinmm -lws2_32 -luser32 -lgdi32 -lcomctl32 -limm32
QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT
Code:
try
{
array2d<rgb_pixel> img;
load_image(img, "C:\\Users\\user\\Downloads\\test.jpg");
}
catch (exception& e)
{
cout << "\nexception thrown!" << endl;
cout << e.what() << endl;
}
MinGW output:
png_loader.cpp:103: undefined reference to 'png_set_longjmp_fn'
png_loader.cpp:153: undefined reference to 'png_set_longjmp_fn'
save_png.cpp:20: undefined reference to 'png_set_longjmp_fn'
save_png.cpp:72: undefined reference to 'png_set_longjmp_fn'
I know that I need to use libpng 1.4, but I can't find this version in GnuWin, so I used the most relevant 1.2.
MSVC runtime exception:
exception thrown!
Unable to load image in file C:\Users\user\Downloads\test.jpg.
You must #define DLIB_JPEG_SUPPORT and link to libjpeg to read JPEG
files.
Do this by following the instructions at http://dlib.net/compile.html.
Note that you must cause DLIB_JPEG_SUPPORT to be defined for your
entire project.
So don't #define it in one file. Instead, add it to the
C/C++->Preprocessor->Preprocessor Definitions
field in Visual Studio's Property Pages window so it takes effect for
your entire application.
But I set -DDLIB_JPEG_SUPPORT in my .pro file, linked with jpeg and png and even downloaded in the working folder shared library jpeg.dll.
How can I solve this probles or how can I use dlib in Qt on Windows?
UPD:
Errors after E:\CMake\bin\cmake.exe --build . --config Release:
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\3d_point_cloud_ex.vcxproj" (default target)
(3) ->
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj" (default target) (4
) ->
(target ClCompile) ->
f:\gstreamer\1.0\x86\include\jmorecfg.h(211): error C2371: 'boolean': redefinition; different basic types [C:\Users\user
\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
C:\Program Files (x86)\Windows Kits\8.1\Include\shared\basetsd.h(72): error C2371: 'INT32': redefinition; different b
asic types [C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
c:\program files (x86)\windows kits\8.1\include\shared\rpcndr.h(178): error C2371: 'boolean': redefinition; different
basic types [C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
c:\program files (x86)\windows kits\8.1\include\shared\wtypesbase.h(493): error C2371: 'BOOLEAN': redefinition; diffe
rent basic types [C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
UPD2:
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\3d_point_cloud_ex.vcxproj" (default target) (3) ->
"C:\Users\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj" (default target) (4) ->
(target ClCompile) ->
C:\Users\user\Downloads\dlib-19.0\dlib-19.0\dlib\image_loader\jpeg_loader.cpp(17): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory [C:\U
sers\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
C:\Users\user\Downloads\dlib-19.0\dlib-19.0\dlib\image_saver\save_jpeg.cpp(16): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory [C:\User
s\user\Downloads\dlib-19.0\dlib-19.0\examples\build\dlib_build\dlib.vcxproj]
UPD3:
.pro file:
INCLUDEPATH += "E:\dlib_build\include"
LIBS += -L"E:\dlib_build"
LIBS += -ldlib
QMAKE_CXXFLAGS_RELEASE += /arch:AVX
QMAKE_CXXFLAGS += -std=c++11 -DDLIB_PNG_SUPPORT -DDLIB_JPEG_SUPPORT
MSVC 2015 64bit Release output:
mainwindow.obj : error LNK2019: unresolved external symbol "public: __cdecl dlib::entropy_decoder_kernel_2::entropy_decoder_kernel_2(void)" (??0entrop...
mainwindow.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl dlib::entropy_decoder_kernel_2::~entropy_decoder_kernel_2(void)" (...
mainwindow.obj : error LNK2019: unresolved external symbol "public: void __cdecl dlib::entropy_decoder_kernel_2::set_stream(class std::basic_istream<c...
mainwindow.obj : error LNK2019: unresolved external symbol "public: void __cdecl dlib::entropy_decoder_kernel_2::decode(unsigned int,unsigned int)" (?...
mainwindow.obj : error LNK2019: unresolved external symbol "public: unsigned int __cdecl dlib::entropy_decoder_kernel_2::get_target(unsigned int)" (?g...
mainwindow.obj : error LNK2019: unresolved external symbol "public: __cdecl dlib::png_loader::png_loader(class std::basic_string<char,struct std::char...
mainwindow.obj : error LNK2019: unresolved external symbol "public: __cdecl dlib::png_loader::~png_loader(void)" (??1png_loader#dlib##QEAA#XZ) referen...
mainwindow.obj : error LNK2019: unresolved external symbol "public: bool __cdecl dlib::png_loader::is_gray(void)const " (?is_gray#png_loader#dlib##QEB...
mainwindow.obj : error LNK2019: unresolved external symbol "public: bool __cdecl dlib::png_loader::is_graya(void)const " (?is_graya#png_loader#dlib##Q...
mainwindow.obj : error LNK2019: unresolved external symbol "public: bool __cdecl dlib::png_loader::is_rgb(void)const " (?is_rgb#png_loader#dlib##QEBA_...
mainwindow.obj : error LNK2019: unresolved external symbol "public: bool __cdecl dlib::png_loader::is_rgba(void)const " (?is_rgba#png_loader#dlib##QEB...
mainwindow.obj : error LNK2019: unresolved external symbol "private: unsigned char const * __cdecl dlib::png_loader::get_row(unsigned int)const " (?ge...
mainwindow.obj : error LNK2019: unresolved external symbol "public: __cdecl dlib::jpeg_loader::jpeg_loader(class std::basic_string<char,struct std::ch...
mainwindow.obj : error LNK2019: unresolved external symbol "public: bool __cdecl dlib::jpeg_loader::is_gray(void)const " (?is_gray#jpeg_loader#dlib##Q...
mainwindow.obj : error LNK2019: unresolved external symbol USER_ERROR__missing_dlib_all_source_cpp_file__OR__inconsistent_use_of_DEBUG_or_ENABLE_ASSER...
E:\dlib_build\lib\dlib.lib : warning LNK4272: library machine type 'X86' conflicts with target machine type 'x64'
release\dlibWindows.exe : fatal error LNK1120: 15 unresolved externals
jom: F:\Projects\QtProjects\build-dlibWindows-Desktop_Qt_5_6_0_MSVC2015_64bit-Release\Makefile.Release [release\dlibWindows.exe] Error 1120
UPD4:
.pro file:
INCLUDEPATH += "E:\dlib_build\include"
LIBS += -L"E:\dlib_build"
LIBS += -ldlib
QMAKE_CXXFLAGS_RELEASE += /arch:AVX
Code:
try
{
//or even just one line "frontal_face_detector detector = get_frontal_face_detector();"
array2d<rgb_pixel> img;
load_image(img, "C:/Users/user/Downloads/test.jpg");
}
catch (exception& e)
{
cout << "\nexception thrown!" << endl;
cout << e.what() << endl;
}
Release output:
Exited with code 255
You have chosen the way of compiling by incliding all/source.cpp into your project. This is possible but I think not the best way how to use dlib.
So if you want to use all/source.cpp in your project - please follow instructions from here: http://dlib.net/compile.html
Compiling on Windows Using Visual Studio
All you need to do is create an empty console project. Then add dlib/all/source.cpp to it and add the folder containing the dlib folder to the #include search path. Then you can compile any example program by adding it to your project.
Again, note that dlib will only be able to work with jpeg and png files if you link in libjpeg and libpng. In Visual Studio, the easiest way to do this is to add all the source files in the dlib/external folder into your project and also define the DLIB_PNG_SUPPORT and DLIB_JPEG_SUPPORT preprocessor directives. If you don't know how to configure Visual Studio then you should use CMake as shown above since it will take care of everything automatically.
And with adding dlib/external folder - you can remove libjpeg and libpng from your project.
But as I said - its not the best way how to compile dlib. Dlib is designed to be used with CMAKE and the best way is to build it with CMAKE.
Why this way is better:
no need to rebuild dlib every time your project changes
possible use of CUDA code (not now - but a bit later when CUDA 8 and VS update 4 will be released)
Here the first step (after installing CMAKE) should be checking if Dlib works. According to Dlib's instructions best way is to build examples and run them (from dlib's folder):
cd examples
mkdir build
cd build
cmake ..
cmake --build . --config Release
When running cmake .. you can specify your compiler version, for example:
cmake .. -G"Visual Studio 14 2015 Win64"
To build examples with Visual Studio 2015 x64
After testing examples its a good time to build Dlib and start using it in real projects. And yes, again build is done by CMAKE (from dlib folder):
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=C:\Users\user\dlib
cmake --build . --config Release --target install
The building process is little different from building examples:
CMAKE_INSTALL_PREFIX=C:\Users\user\dlib - compiled dlib will be installed into C:\Users\user\dlib
--target install means we are installing dlib
After the building process will be finished - you are free to use dlib.lib (static version of Dlib) from C:\Users\user\dlib\lib. If you will use CMAKE with your project - you will need to add -DCMAKE_PREFIX_PATH=c:\Users\user\dlib. But now you are trying to compile with Qt Creator (QMake). Here is your .pro file should look like (the minimal possible example):
SOURCES += face_detection_ex.cpp
INCLUDEPATH += "C:\Users\user\dlib\include"
LIBS += -L"C:\Users\user\dlib"
LIBS += -ldlib
QMAKE_CXXFLAGS_RELEASE += /arch:AVX
This project will not compile and run in Debug mode build because we used --config Release in our building process. But Release mode will run very fast
Please note
Visual Studio will need separate dlib installation for Release and Debug builds. And Debug build of Dlib will be extremely slow
Adding /arch:AVX to compiler flags (MSVC) will make Dlib run much faster
DNN module will not work under MSVC until Cuda 8 and MSVC 2015 update 4 will be released

Qt Creator LNK2019:Unresolved external symbol using OpenCV

I've been trying to compile a project for the past two days in Qt using OpenCV but can't figure out why it doesn't. My application has only main.cpp, widget.cpp and widget.h
here is my .pro file
QT += core gui opengl
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = FaceDetect
TEMPLATE = app
SOURCES += main.cpp\
widget.cpp
HEADERS += widget.h
FORMS += widget.ui
INCLUDEPATH += C:/opencv/build/include/
LIBS += -LC:/opencv/build/x64/vc10/lib/
-libopencv_core2410
-libopencv_highgui2410
-libopencv_imgproc2410
-libopencv_features2d2410
-libopencv_calib3d24610
and these are the errors I keep getting:
main.obj:-1: error: LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release#Mat#cv##QAEXXZ)
moc_widget.obj:-1: error: LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ)
moc_widget.obj:-1: error: LNK2001: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate#Mat#cv##QAEXXZ)
Can anyone explain why and how I an get rid of these please?
Thanks!
Put a slash at the end of every file in LIBS and save it.
LIBS += -LC:/opencv/build/x64/vc10/lib/
-libopencv_core2410 \
-libopencv_highgui2410 \
-libopencv_imgproc2410 \
-libopencv_features2d2410 \
-libopencv_calib3d24610
Now right click the project folder and click "Run qmake" and then 'build' it, this will 'make' the file and consider the changes made in .pro file.

Building a static library for glut 3.7 on Windows

I've been trying to compile glut as a static library without having to link with glut32.dll on runtime. I downloaded the glut windows source code but when I try to compile (default), I keep getting:
Making in glut subdirectory...
link /INCREMENTAL:NO /NOLOGO -entry:_DllMainCRTStartup#12 -dll -out:glut32.dll -def:glut.def glut_8x13.obj glut_9x15.obj glut_bitmap.obj glut_bwidth.obj glut_cindex.obj glut_cmap.obj glut_cu
rsor.obj glut_dials.obj glut_dstr.obj glut_event.obj glut_ext.obj glut_fullscrn.obj glut_gamemode.obj glut_get.obj glut_hel10.obj glut_hel12.obj glut_hel18.obj glut_init.obj glut_input.obj glut_joy.ob
j glut_key.obj glut_keyctrl.obj glut_keyup.obj glut_mesa.obj glut_modifier.obj glut_mroman.obj glut_overlay.obj glut_roman.obj glut_shapes.obj glut_space.obj glut_stroke.obj glut_swap.obj glut_swidth.
obj glut_tablet.obj glut_teapot.obj glut_tr10.obj glut_tr24.obj glut_util.obj glut_vidresize.obj glut_warp.obj glut_win.obj glut_winmisc.obj win32_glx.obj win32_menu.obj win32_util.obj win32_winproc.o
bj win32_x11.obj opengl32.lib glu32.lib winmm.lib kernel32.lib ws2_32.lib mswsock.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib
LINK : fatal error LNK1104: cannot open file 'glut32.lib'
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x450'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\nmake.EXE"' : return code '0x2'
Stop.
From what I understand, glut32.lib should be compiled and created in {source}\lib\glut\ but it's not there.
Any help compiling a static library for glut would be appreciated.
Edit:
In Makefile.win
Changed:
$(link) $(LFLAGS) -out:$(GLUTDLL) -def:glut.def $(OBJS) $(LIBS)
to
lib $(OBJS) $(LIBS)
It generated \lib\glut\glut_8x13.lib not sure what the 8x13 is about but when I tried to link with it, I got some unresolved externals:
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutCreateWindow#4 referenced in function "protected: __thiscall GlobalDecl::OpenGLConte
xt::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext#GlobalDecl##IAE#II#Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitWindowSize#8 referenced in function "protected: __thiscall GlobalDecl::OpenGLCon
text::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext#GlobalDecl##IAE#II#Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitWindowPosition#8 referenced in function "protected: __thiscall GlobalDecl::OpenG
LContext::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext#GlobalDecl##IAE#II#Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInitDisplayMode#4 referenced in function "protected: __thiscall GlobalDecl::OpenGLCo
ntext::OpenGLContext(unsigned int,unsigned int)" (??0OpenGLContext#GlobalDecl##IAE#II#Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutInit#8 referenced in function "protected: __thiscall GlobalDecl::OpenGLContext::Open
GLContext(unsigned int,unsigned int)" (??0OpenGLContext#GlobalDecl##IAE#II#Z)
GPURenderer_test.obj : error LNK2019: unresolved external symbol __imp__glutSwapBuffers#0 referenced in function "protected: void __thiscall GlobalDecl::OpenGLC
ontext::_executeTest(class GlobalDecl::UnitTest &)" (?_executeTest#OpenGLContext#GlobalDecl##IAEXAAVUnitTest#2##Z)
Thanks,
Ryan
It looks to me like you have something pretty badly munged up in your build setup (or you're using the wrong build setup completely, such as trying to build some samples before you've built the library they use).
To build a static library, you shouldn't be running link at all. For a static library, you compile your object files, then use lib to put them together into a library. You'd use link to build a dynamic library (DLL) or an executable, but not a static library.

Error during QT Build with OpenSSL

1.Download source from OpenSSL (openssl-1.0.0d).
2.Build it static using this:
> perl Configure VC-WIN32 no-asm --prefix=d:\Miatar\cpplibs\openssl
> ms\do_ms
> nmake -f ms\nt.mak
> nmake -f ms\nt.mak install
3.Download qt-everywhere-opensource-src-4.7.1,
patching it (QTDIR\mkspecs\win32-msvc2010\qmake.conf - /MD to /MT and /MDd to /MTd)
copying bin / lib / include folders of openssl to QTDIR bin / lib / include folders
and trying to build it using next *.bat
setlocal
set MAKEFLAGS=
call "D:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" x86
set QMAKESPEC=win32-msvc2010
set PATH=%CD%\bin;%PATH%
configure -debug-and-release -platform win32-msvc2010 -static -no-crt -no-qt3support -nomake examples -nomake demos -openssl-linked -I "d:\Miatar\cpplibs\openssl\include" -L "d:\Miatar\cpplibs\openssl\lib"
nmake
pause
endlocal
getting error during nmake
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
"D:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe" -f Makefile.Debug all
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
cl -c -nologo -Zm200 -Zc:wchar_t- -Zi -MTd -MP -GR -EHsc -W3 -w34100 -w3 4189 -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_XMLPATTERNS_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\include\QtCore" -I"..\..\include\QtXmlPatterns" -I"..\..\include" -I"d:\Miatar\cpplibs\openssl\include" -I"..\..\include\ActiveQt" -I"tmp\moc\debug_static" -I"..\..\mkspecs\win32-msvc2010" -Fotmp\obj\debug_static\ #C:\Users\Daminian\AppData\Local\Temp\nm3A5A.tmp
main.cpp
qapplicationargument.cpp
qapplicationargumentparser.cpp
link /LIBPATH:"d:\Miatar\cpplibs\QtStaticSSL\lib" /LIBPATH:"d:\Miatar\cpplibs\QtStaticSSL\lib" /NOLOGO /DELAYLOAD:"OleAcc.dll" /DEBUG /SUBSYSTEM:CONSOLE /MANIFEST /MANIFESTFILE:"tmp\obj\debug_static\xmlpatterns.intermediate.manifest" /OUT:..\..\bin\xmlpatterns.exe #C:\Users\Daminian\AppData\Local\Temp\nm416C.tmp
LINK :
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__DeleteDC#4 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__DeleteObject#4 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetBitmapBits#12 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__BitBlt#36 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetObjectA#12 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__SelectObject#8 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__CreateCompatibleBitmap#12 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__GetDeviceCaps#8 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__CreateCompatibleDC#4 referenced in function _readscreen
libeay32.lib(rand_win.obj) : error LNK2019: unresolved external symbol __imp__CreateDCA#16 referenced in function _readscreen
..\..\bin\xmlpatterns.exe : fatal error LNK1120: 10 unresolved externals
NMAKE : fatal error U1077: '"D:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"D:\Program Files\Microsoft Visual Studio 10.0\VC\BIN\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
any help? Here says that i can fix it by adding Gdi32.lib to your list of libraries. How to do that?
You have to add -L "path/to/dir/with/Gdi32library/" and -l Gdi32 params when you run configure.
Example: configure -L "C:/Program Files (x86)/Microsoft SDKs/Windows/v7.1A/Lib/" -l Gdi32