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
Related
I'm compiling HTTPD 2.4.48 along with Lua, Zlib, cURL, jansson and OpenSSL.
Here is the list of files and software I use:
httpd-2.4.48
apr-1.7.0
apr-util-1.6.1
cURL 7.77.0
expat-2.4.1
jansson 2.13.1
Lua 5.4.3
mod_fcgid 2.3.9
openssl-1.1.1k
pcre-8.44
ZLIB 1.2.11
ActivePerl v5.28.1.2801 (x64)
CMake v3.20.3 (x64)
NASM v2.15.05 (x64)
Gawk v3.1.6-1 (x86)
The whole compile statement I use:
Visual Studio 2015: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64
*****************
** ZLIB Build **
*****************
cd /D C:\httpd\srclib\zlib\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
nmake
nmake install
****************
** Pcre Build **
****************
cd /D C:\httpd\srclib\pcre\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DPCRE_BUILD_TESTS=OFF -DPCRE_BUILD_PCRECPP=OFF -DPCRE_BUILD_PCREGREP=OFF -DPCRE_SUPPORT_PCREGREP_JIT=OFF -DPCRE_SUPPORT_UTF=ON -DPCRE_SUPPORT_UNICODE_PROPERTIES=ON -DPCRE_NEWLINE=CRLF -DINSTALL_MSVC_PDB=OFF ..
nmake
nmake install
*****************
** Expat Build **
*****************
cd /D C:\httpd\srclib\expat\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
nmake
nmake install
*******************
** OpenSSL Build **
*******************
cd /D C:\httpd\srclib\openssl
perl Configure VC-WIN64A --release --prefix=\phpStudy\Apache --openssldir=\phpStudy\Apache\conf enable-camellia no-idea no-mdc2 no-ssl2 no-ssl3
nmake
nmake install
***************
** Lua Build **
***************
cd /D C:\httpd\srclib\lua\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release ..
nmake
nmake install
****************
** cURL Build **
****************
cd /D C:\httpd\srclib\curl\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
nmake
nmake install
*******************
** jansson Build **
*******************
cd /D C:\httpd\srclib\jansson\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON ..
nmake
nmake install
***************
** APR Build **
***************
cd /D C:\httpd\srclib\apr\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DMIN_WINDOWS_VER=0x0600 -DAPR_HAVE_IPV6=ON -DAPR_INSTALL_PRIVATE_H=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=OFF ..
nmake
nmake install
********************
** APR-Util Build **
********************
cd /D C:\httpd\srclib\apr-util\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DOPENSSL_ROOT_DIR=\phpStudy\Apache -DAPU_HAVE_CRYPTO=ON -DAPR_BUILD_TESTAPR=OFF -DINSTALL_PDB=OFF ..
nmake
nmake install
******************
** Apache Build **
******************
cd /D C:\httpd\bin
cmake -G "NMake Makefiles" -DCMAKE_INSTALL_PREFIX=\phpStudy\Apache -DCMAKE_BUILD_TYPE=Release -DENABLE_MODULES=i -DINSTALL_PDB=OFF ..
nmake
nmake install
Everything worked almost perfectly, however in the last step when I compile HTTPD I got the error:
[ 44%] Linking C shared library mod_md.so
LINK: command "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe /nologo #CMakeFiles\mod_md.dir\objects1.rsp /out:mod_md.so /implib:mod_md.lib /pdb:C:\httpd\bin\mod_md.pdb /dll /version:0.0 /base:#C:/httpd/bin/BaseAddr.ref,mod_md.so /machine:x64 /INCREMENTAL:NO \phpStudy\Apache\lib\libssl.lib \phpStudy\Apache\lib\libcrypto.lib \phpStudy\Apache\lib\jansson.lib mod_watchdog.lib libhttpd.lib \phpStudy\Apache\lib\libapr-1.lib \phpStudy\Apache\lib\libaprutil-1.lib \phpStudy\Apache\lib\apr_ldap-1.lib ws2_32.lib mswsock.lib \phpStudy\Apache\lib\pcre.lib ws2_32.lib mswsock.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:mod_md.so.manifest" failed (exit code 1120) with the following output:
Creating library mod_md.lib and object mod_md.exp
md_curl.c.obj : error LNK2019: unresolved external symbol curl_global_init referenced in function md_curl_init
md_curl.c.obj : error LNK2019: unresolved external symbol curl_slist_append referenced in function curlify_headers
md_curl.c.obj : error LNK2019: unresolved external symbol curl_slist_free_all referenced in function md_curl_req_cleanup
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_strerror referenced in function md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_init referenced in function internals_setup
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_setopt referenced in function internals_setup
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_perform referenced in function md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_cleanup referenced in function md_curl_req_cleanup
md_curl.c.obj : error LNK2019: unresolved external symbol curl_easy_getinfo referenced in function md_curl_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_init referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_add_handlereferenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_remove_handle referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_wait referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_perform referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_cleanup referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_info_read referenced in function md_curl_multi_perform
md_curl.c.obj : error LNK2019: unresolved external symbol curl_multi_strerror referenced in function md_curl_multi_perform
mod_md.so : fatal error LNK1120: 17 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\CMake\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
I found out the answer of this question: Visual Studio 2015 curl will not statically link
Change the code of the md_curl.c file to:
#pragma comment(lib, "wldap32.lib" )
#pragma comment(lib, "crypt32.lib" )
#pragma comment(lib, "Ws2_32.lib")
#define CURL_STATICLIB
#include <curl/curl.h>
But this error still occurs.
Where did I go wrong? I'm getting confused because this is the first time I've encountered this error when compiling HTTPD.
Your answer will be very helpful. I would appreciate that!
Whenever you fix issues, start by the first one (cause solving that may remove the remaining), which in you case seems to be:
error LNK2019: unresolved external symbol curl_global_init referenced in function md_curl_init
And it basically is telling us that, the md_curl_init method calls curl_global_init method, but while compile-time declaration was available, the linker-time required definition is missing.
Anyway, to fix this ensure curl is added as a library, I mean, is currently not in your linker command-line (not in what you posted at least).
Edit I will suggest you approaches, for how you can do that.
But first, giving it more time, I see that:
Yes, you already compile curl.
Your "whole compile statement" thing is using C:\httpd\srclib\curl\bin as build-directory for cURL.
Also, you should be able to find curl.lib in C:\httpd\srclib\curl\bin directory (which was used as build-directory).
Approach #1:
Create a root CMakeFiles.txt file and add your other projects with add_subdirectory(...) method.
I recommend this approach, as CMake will handle for you the task of finding curl automatically.
I mean, you just would need to do something like:
target_link_libraries(myTargetThatNeedsCurl
curl
)
Approach #2:
If you don't want to change "whole compile statement" thing, then your only choice may be to place curl.lib somewhere that your other build-script can find it (manually or through some custom install(...) method calls, I leave that to you).
Approach #3:
First, edit httpd project (the C:\httpd\CMakeFiles.txt file), and add add_subdirectory(srclib/curl) somewhere in beginning.
Then, find cURL target's name, like, open the C:\httpd\srclib\curl\CMakeFiles.txt file and see all add_library(...) call's first argument (one of them is what we want).
Finally, edit httpd project again, but now add what you found in step-2 as argument to target_link_libraries(...) method.
Note that Approach #3 is same as #2, but just for cURL (instead of adding all sub-directories).
Im trying to link Qt Creator to Clion so i can use it for creating GUI elements but the only information I was able to find on doing this was this thread
How to configure CLion IDE for Qt Framework?
I tried to follow this as closely as possible but one of the major differences is that on windows there is no clang_64 file instead it is msvc2017_64 and that is what seems to be showing up in the error im getting.
My CmakeLists.txt
cmake_minimum_required(VERSION 3.5)
project(helloqt)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(SOURCE_FILES main.cpp)
find_package(Qt5Widgets REQUIRED)
add_executable(helloqt ${SOURCE_FILES})
target_link_libraries(helloqt Qt5::Widgets)
my main.cpp
#include <QApplication>
#include <QDebug>
using namespace std;
int main() {
qDebug() << QT_VERSION_STR;
return 1;
}
under Settings>Build, Execution, Deployment > CMake my Cmake Options has the path
-DCMAKE_PREFIX_PATH=C:/Qt/5.12.1/msvc2017_64/lib/cmake
and it results in this error which I have not been able to find a fix to.
"C:\Program Files\JetBrains\CLion 2018.3.4\bin\cmake\win\bin\cmake.exe" --build C:\Users\Uncorropto\CLionProjects\helloqt\cmake-build-debug --target helloqt --
Scanning dependencies of target helloqt
[ 50%] Building CXX object CMakeFiles/helloqt.dir/main.cpp.obj
main.cpp
[100%] Linking CXX executable helloqt.exe
LINK Pass 1: command "C:\PROGRA~2\MIB055~1\2017\COMMUN~1\VC\Tools\MSVC\1414~1.264\bin\Hostx86\x86\link.exe /nologo #CMakeFiles\helloqt.dir\objects1.rsp /out:helloqt.exe /implib:helloqt.lib /pdb:C:\Users\Uncorropto\CLionProjects\helloqt\cmake-build-debug\helloqt.pdb /version:0.0 /machine:X86 /debug /INCREMENTAL /subsystem:console C:\Qt\5.12.1\msvc2017_64\lib\Qt5Widgetsd.lib C:\Qt\5.12.1\msvc2017_64\lib\Qt5Guid.lib C:\Qt\5.12.1\msvc2017_64\lib\Qt5Cored.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:CMakeFiles\helloqt.dir/intermediate.manifest CMakeFiles\helloqt.dir/manifest.res" failed (exit code 1120) with the following output:
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QMessageLogger::QMessageLogger(char const *,int,char const *)" (__imp_??0QMessageLogger##QAE#PBDH0#Z) referenced in function _main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QDebug __thiscall QMessageLogger::debug(void)const " (__imp_?debug#QMessageLogger##QBE?AVQDebug##XZ) referenced in function _main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QDebug::~QDebug(void)" (__imp_??1QDebug##QAE#XZ) referenced in function _main
main.cpp.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QDebug & __thiscall QDebug::operator<<(char const *)" (__imp_??6QDebug##QAEAAV0#PBD#Z) referenced in function _main
C:\Qt\5.12.1\msvc2017_64\lib\Qt5Widgetsd.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Qt\5.12.1\msvc2017_64\lib\Qt5Guid.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
C:\Qt\5.12.1\msvc2017_64\lib\Qt5Cored.lib : warning LNK4272: library machine type 'x64' conflicts with target machine type 'x86'
helloqt.exe : fatal error LNK1120: 4 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\JetBrains\CLion 2018.3.4\bin\cmake\win\bin\cmake.exe"' : return code '0xffffffff'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x86\nmake.exe"' : return code '0x2'
Stop.
It can't find symbol like QMessageLogger which is part of Qt Core. Note you have used qDebug() which refers to this symbols!
Conclusion is simple add this to your CMakeLists.txt:
find_package(Qt5Core REQUIRED) # this might be not needed
target_link_libraries(helloqt Qt5::Widgets Qt5::Core)
Offtopic: trash this:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
since it doesn't do anything.
Try this under project(helloqt):
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
I can not figure out why I am getting the errors:
main.obj:-1: error: LNK2019: unresolved external symbol "public: __thiscall Standbywindow::Standbywindow(void)" (??0Standbywindow##QAE#XZ) referenced in function _main
and
debug\pointer_test.exe:-1: error: LNK1120: 1 unresolved externals
Main.cpp
#include <QCoreApplication>
#include <QDebug>
#include "standby.h"
Standbywindow *standby_window;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
standby_window = new Standbywindow;
return a.exec();
}
standby.h
#ifndef STANDBY_H
#define STANDBY_H
#include <QDebug>
class Standbywindow{
public:
Standbywindow();
};
#endif // STANDBY_H
standby.cpp
#include "standby.h"
Standbywindow::Standbywindow(){
}
pointer_test.pro
#-------------------------------------------------
#
# Project created by QtCreator 2015-05-10T11:08:06
#
#-------------------------------------------------
QT += core
QT -= gui
TARGET = pointer_test
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp \
standby.cpp
HEADERS += \
standby.h
compile output
09:08:23: Running steps for project pointer_test...
09:08:23: Configuration unchanged, skipping qmake step.
09:08:23: Starting: "C:\Qt\Tools\QtCreator\bin\jom.exe"
C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Debug
cl -c -nologo -Zm200 -Zc:wchar_t -Zi -MDd -GR -W3 -w34100 -w34189 -EHsc /Fddebug\pointer_test.pdb -DUNICODE -DWIN32 -DQT_CORE_LIB -I"..\pointer_test" - I"." -I"C:\Qt\5.4\msvc2010_opengl\include" -I"C:\Qt\5.4\msvc2010_opengl\include\QtCore" -I"debug" -I"C:\Qt\5.4\msvc2010_opengl\mkspecs\win32-msvc2010" -Fodebug\ #C:\Users\Mike\AppData\Local\Temp\main.obj.10328.16.jom
main.cpp
echo 1 /* CREATEPROCESS_MANIFEST_RESOURCE_ID */ 24 /* RT_MANIFEST */ "debug\\pointer_test.exe.embed.manifest">debug\pointer_test.exe_manifest.rc
if not exist debug\pointer_test.exe if exist debug\pointer_test.exe.embed.manifest del debug\pointer_test.exe.embed.manifest
if exist debug\pointer_test.exe.embed.manifest copy /Y debug\pointer_test.exe.embed.manifest debug\pointer_test.exe_manifest.bak
link /NOLOGO /DYNAMICBASE /NXCOMPAT /DEBUG /SUBSYSTEM:CONSOLE "/MANIFESTDEPENDENCY:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' publicKeyToken='6595b64144ccf1df' language='*' processorArchitecture='*'" /MANIFEST /MANIFESTFILE:debug\pointer_test.exe.embed.manifest /OUT:debug\pointer_test.exe #C:\Users\Mike\AppData\Local\Temp\pointer_test.exe.10328.2250.jom
main.obj : error LNK2019: unresolved external symbol "public: __thiscall Standbywindow::Standbywindow(void)" (??0Standbywindow##QAE#XZ) referenced in function _main
debug\pointer_test.exe : fatal error LNK1120: 1 unresolved externals
jom: C:\Users\Mike\Documents\QT\build-pointer_test- Desktop_Qt_5_4_1_MSVC2010_OpenGL_32bit-Debug\Makefile.Debug [debug\pointer_test.exe] Error 1120
jom: C:\Users\Mike\Documents\QT\build-pointer_test- Desktop_Qt_5_4_1_MSVC2010_OpenGL_32bit-Debug\Makefile [debug] Error 2
09:08:26: The process "C:\Qt\Tools\QtCreator\bin\jom.exe" exited with code 2.
Error while building/deploying project pointer_test (kit: Desktop Qt 5.4.1 MSVC2010 OpenGL 32bit)
When executing step "Make"
09:08:26: Elapsed time: 00:03.
Make sure standby.cpp is listed as a source file in your .pro file, then try running QMake again (build -> run qmake), THEN try to build. You can also try cleaning/rebuilding your project.
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
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.