LInker error when switching from windows to console - qt

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.

Related

Static linking Qt 5.7 with Visual Studio 2015

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.

xcode static library link error while building for iPhone device

I am using xcode 4.6. The SDK is iOS 6.1. The error I got is "Undefined symbols for architecture armv7" while project linking my own created static library, called "libEncrypt.a".
I am sure I have created the libEncrpt.a using architecture armv7. Using "otool -a" to verify the static library, it displays below message. Don't understand why xcode sill complains the error like "Undefined symbols for architecture armv7"??
> otool -a libEncrypt.a
Archive : libEncrypt.a (architecture armv7)
0100644 505/20 108 1360127518 #1/20
0100644 505/20 3604 1360127513 #1/20
Archive : libEncrypt.a (architecture armv7s)
0100644 505/20 108 1360127518 #1/20
0100644 505/20 3604 1360127513 #1/20
Add the detail error message blow:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_libEncrypt", referenced from:
objc-class-ref in LoginViewController.o
objc-class-ref in SignupViewController.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Double check your "Build Active Architecture Only" settings in your app and static library projects.
I had this exact same issue because I had "Build Active Architecture Only" set to YES for my static library but not for my iOS app. When the iOS app tried do a Debug build it expected all architectures to exist but only armv7s was being built for the static library because I was deploying to my iPhone 5.

Qt based program linked in debug mode but not in release mode

I'm writing a Qt based project using Visual Studio 2008 Compiler . In the debug mode every thing is OK and the program compiled and linked successfully but when I switch to release mode and I start to compile I get this error during linking :
1>Linking...
1>MSVCRT.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain#16 referenced in function ___tmainCRTStartup
1>release\\MobnaPC.exe : fatal error LNK1120: 1 unresolved externals
But main function has defined!
Thank you in advance

Open CL with AMD

I am trying to implement matrix multiplication usign OpenCL. I have an ATI Radeon HD Radeon 5000 series graphics card.
This is one of the programs i found on the net, but linking errors are coming which i am not able to solve.
I tried running the code mentioned in this site
http://gpgpu-computing4.blogspot.in/2009/10/matrix-multiplication-3-opencl.html
I followed setting up my visual studio project from this site http://www.guineacode.com/2010/linking-and-compiling-opencl/
but the following errors come
error LNK2019: unresolved external symbol _oclLoadProgSource referenced in function _main
error LNK2019: unresolved external symbol _shrLogEx referenced in function "void __cdecl __shrCheckErrorEX(int,int,void (__cdecl*)(int),char const *,int)" (?__shrCheckErrorEX##YAXHHP6AXH#ZPBDH#Z)
Any help would be appreciated
Can you try this ?
Make sure you have the latest Catalyst driver from AMD.
Try downloading AMD APP SDK 2.6 from here : http://developer.amd.com/sdks/AMDAPPSDK/downloads/Pages/default.aspx
After the install, do the following
Make sure to include $(AMDAPPSDKROOT)\include for header files
Library Directory : $(AMDAPPSDKROOT)\lib\x86 or x86_64 depending on your bitness
4.Now you can build and run the program
Here is an older post which talks about linking 2.4... with slight modification you can use the instruction
http://blog.cuvilib.com/2011/07/01/how-to-run-opencl-in-microsoft-vs-2008-using-amd-app-sdk/
If you are looking only MatrixMultiplication sample, AMD APP SDK bundles some samples along with pack you can find them in (Windows)
C:\USERS\%USER%\My Documents\AMD APP\ Samples
and in Linux under
/opt/AMD APP SDK/Samples
HTH

error with Qt libraries in visual c++ application

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++

Resources