Qt Visual Studio 2015 Add-in compilation problem - c++

I use Qt Add-in in my project. But i dont understand , what i do uncorrect.
My .pro file:
QT += core gui network
TEMPLATE = app
TARGET = MMworker
DESTDIR = ../Debug
CONFIG += debug
LIBS += -L"../../../../boost_1_70_0/stage/lib"
DEPENDPATH += .
MOC_DIR += .
OBJECTS_DIR += debug
UI_DIR += .
RCC_DIR += .
Get a lot of errors. For example
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall QHostAddress::QHostAddress(void)" (__imp_??0QHostAddress##QAE#XZ) referenced in function...
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __thiscall QHostAddress::setAddress(class QString const &)" (__imp_?setAddress#QHostAddress##QAE_NABVQString###Z) referenced in function ...
Error LNK2019 unresolved external symbol "public: void __thiscall TcpServer::connectToServer(class QHostAddress,int)" (?connectToServer#TcpServer##QAEXVQHostAddress##H#Z) referenced in function...
Error LNK2019 unresolved external symbol "public: bool __thiscall MainTimer::timeAfterMomentExceeds(__int64,__int64)" (?timeAfterMomentExceeds#MainTimer##QAE_N_J0#Z) referenced in function ...
Error LNK2019 unresolved external symbol "private: __int64 __thiscall MainTimer::getMilliseconds(void)" (?getMilliseconds#MainTimer##AAE_JXZ) referenced in function "public: __int64 __thiscall MainTimer::time_ms(void)" (?time_ms#MainTimer##QAE_JXZ)...
Error LNK2019 unresolved external symbol "public: void __thiscall Channel::readData(class QString &)" (?readData#Channel##QAEXAAVQString###Z) referenced in function ...
Error LNK2001 unresolved external symbol "public: virtual void * __thiscall SimpleDevice::qt_metacast(char const *)" (?qt_metacast#SimpleDevice##UAEPAXPBD#Z)...
P.S.: Also I look in qt simple tcp communication with ui projects . I dont understand how I can "You need to enable modules you're using in Qt Project Settings".
UPD1: compile was sucsess, but build still falling.

Error was in inlcude additional dependensies(removed) and included dirs(added)

Related

Using non-qtcore libraries on Visual Studio using Qt VS Tools causes LNK2019

I am trying to use QSoundEffect from QtMultimedia. I have included the file like so:
#include <QtMultimedia/QSoundEffect>
and used QSoundEffect in my project.
When I try to compile my project after this, I get LNK2019 errors:
1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSoundEffect::QSoundEffect(class QObject *)" (__imp_??0QSoundEffect##QEAA#PEAVQObject###Z) referenced in function "public: __cdecl ChatWindow::ChatWindow(class QWidget *)" (??0ChatWindow##QEAA#PEAVQWidget###Z)
1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSoundEffect::~QSoundEffect(void)" (__imp_??1QSoundEffect##UEAA#XZ) referenced in function "int `public: __cdecl ChatWindow::ChatWindow(class QWidget *)'::`1'::dtor$3" (?dtor$3#?0???0ChatWindow##QEAA#PEAVQWidget###Z#4HA)
1>chatwindow.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSoundEffect::setSource(class QUrl const &)" (__imp_?setSource#QSoundEffect##QEAAXAEBVQUrl###Z) referenced in function "public: __cdecl ChatWindow::ChatWindow(class QWidget *)" (??0ChatWindow##QEAA#PEAVQWidget###Z)
1>mainwidget.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSoundEffect::play(void)" (__imp_?play#QSoundEffect##QEAAXXZ) referenced in function "private: void __cdecl MainWidget::process_received_forever(void)" (?process_received_forever#MainWidget##AEAAXXZ)
How can I tell Visual Studio about the existence of QtMultimedia related files? Qt include and library paths are handled by the Qt VS Tools extension in Visual Studio, so I'm a bit confused.
For some weird reason, it worked when I manually added Qt5's libpath to library paths and Qt5Multimedia.lib to included libraries manually.

__declspec(dllimport) in release mode and debug mode in QT

i want to use taglib in my QT project on windows, so i build taglib and zlib from source like below:
cmake CMakeLists.txt
cmake --build --config release
cmake command uses visual studio compiler, i build zlib and taglib from source with above command with no error, i added their include and lib path to QT project .pro file like below:
INCLUDEPATH+=F:\project\TAGLIB\taglib\taglib F:\project\TAGLIB\taglib\taglib\toolkit F:\project\TAGLIB\taglib F:\project\zlib-1.2.11\Release F:\project\zlib-1.2.11
LIBS+=-LF:\project\zlib-1.2.11\Release -lzlib
LIBS+= -LF:\project\TAGLIB\taglib\taglib\Release -ltag
LIBS+=-LF:\project\TAGLIB\taglib\taglib\Debug -ltag
LIBS+=-LF:\project\zlib-1.2.11\Debug -lzlibd
and in main.cpp i added:
#include<fileref.h>
#include<tag.h>
#include<QDebug>
and in main function:
TagLib::FileRef f("C:\\Users\\sub\\Downloads\\Mohsen Chavoshi - Sharhe Alef.mp3");
TagLib::String artist = f.tag()->artist();
when i run my application in debug mode,it doesn't run and give me below errors:
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl TagLib::String::~String(void)" (__imp_??1String#TagLib##UEAA#XZ) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: char const * __cdecl TagLib::String::toCString(bool)const " (__imp_?toCString#String#TagLib##QEBAPEBD_N#Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl TagLib::FileName::FileName(char const *)" (__imp_??0FileName#TagLib##QEAA#PEBD#Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl TagLib::FileRef::FileRef(class TagLib::FileName,bool,enum TagLib::AudioProperties::ReadStyle)" (__imp_??0FileRef#TagLib##QEAA#VFileName#1#_NW4ReadStyle#AudioProperties#1##Z) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl TagLib::FileRef::~FileRef(void)" (__imp_??1FileRef#TagLib##UEAA#XZ) referenced in function main
main.obj:-1: error: LNK2019: unresolved external symbol "__declspec(dllimport) public: class TagLib::Tag * __cdecl TagLib::FileRef::tag(void)const " (__imp_?tag#FileRef#TagLib##QEBAPEAVTag#2#XZ) referenced in function main
debug\testTag2.exe:-1: error: LNK1120: 6 unresolved externals
but when i run application in Release mode,the above error are just some Warning and application run with no problem, why this is happening?
thank you.

LNK2019 and LNK2001 when using quickfix library in Qt Creator

I'm building a project using Qt Creator, which at the same time, using QuickFIX library. When I try to build the project using MSVC 2015 32bits build, it always has these two kinds of linker error:
error: LNK2019: unresolved external symbol "private: static double __cdecl FIX::DoubleConvertor::fast_strtod(char const *,int,int *)" (?fast_strtod#DoubleConvertor#FIX##CANPBDHPAH#Z) referenced in function "public: static bool __cdecl FIX::DoubleConvertor::convert(class
std::basic_string,class std::allocator > const &,double &)" (?convert#DoubleConvertor#FIX##SA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##AAN#Z)
error: LNK2001: unresolved external symbol "private: static double __cdecl FIX::DoubleConvertor::fast_strtod(char const *,int,int *)" (?fast_strtod#DoubleConvertor#FIX##CANPBDHPAH#Z
But I'm not using these double convertor anywhere in my project and I thought the quickfix library should have export all function from its source.
I've tried it on 64bits or MSVC 2017 build, nothing works..
I've been trying these for several weeks... It's driving me crazy
edit: my .pro file:
DEPENDPATH += $$(QuickFIX_VS2017)/include/quickfix
INCLUDEPATH += $$(QuickFIX_VS2017)/include/quickfix
Debug:LIBS += -L$$(QuickFIX_VS2017)/x64/Debug/ -lquickfix
Debug:PRE_TARGETDEPS += $$(QuickFIX_VS2017)/x64/Debug/quickfix.lib
Release:LIBS += -L$$(QuickFIX_VS2017)/x64/Release -lquickfix
Release:PRE_TARGETDEPS += $$(QuickFIX_VS2017)/x64/Release/quickfix.lib

Abnormal unresolved external symbol error

I have a project that used to compile just fine, using the freetype library.
Since then my OS has been reinstalled and therefore so has Visual Studio 2010.
I have re-included and reinstalled all of the .lib .dll and header files. For some reason now if I run the program with the release configuration it runs just fine. But if I switch over to the debug config, it gives me unresolved external symbol errors from the linker, on the freetype library functions.
Now I'm sure my C++ directories for both configurations are identical as I re-set them using the all-configurations tab in the solution settings. As well as this, so are both configurations "additional directories/additional dependancies settings", set identically in the same way.
The only difference I could find between the release and debug folders in the project folder, is the presence of a file in the debug folder called "vc100.idb", which is a minimum rebuild dependancy file. This looked promising, but removing it yielded no results, so I put it back.
Do you have any ideas of what could be causing this difference between the configurations compiling?
Worst come to worst, I can continue programming on the release config, but I'd rather not continue down this road as I'd really like to know the root of this problem.
Thanks in advance,
Guy
The errors:
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Glyph_To_Bitmap referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist#freetype##YAXPAUFT_FaceRec_##DIPAI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Get_Glyph referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist#freetype##YAXPAUFT_FaceRec_##DIPAI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Load_Glyph referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist#freetype##YAXPAUFT_FaceRec_##DIPAI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Get_Char_Index referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist#freetype##YAXPAUFT_FaceRec_##DIPAI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Done_FreeType referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init#font_data#freetype##QAEXPBDI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Done_Face referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init#font_data#freetype##QAEXPBDI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Set_Char_Size referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init#font_data#freetype##QAEXPBDI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_New_Face referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init#font_data#freetype##QAEXPBDI#Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Init_FreeType referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init#font_data#freetype##QAEXPBDI#Z)
Edit: OK well this is strange. I've removed ALL of the freetype directory information rom the include and library directory setting in the release config, as well as the additional dependancies. And the released config version still works!
This is leading me to believe there is something missing (vs config-wise) from moving my files over.
I had the same problem.
I solved it by compiling the freetype( freetype-2.5.2\builds\windows\vc2010\freetype.sln ) solution for the x64 platform (or win32 if you use it).
You will get the .libs for this platform.

Unresolved external symbols in Visual Studio 2010

I am coming from Xcode, trying to compile a project in Visual Studio 2010, and I get the following errors:
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "struct _GUID __cdecl CLEyeGetCameraUUID(int)" (?CLEyeGetCameraUUID##YA?AU_GUID##H#Z) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices#ofxCLeye##SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "int __cdecl CLEyeGetCameraCount(void)" (?CLEyeGetCameraCount##YAHXZ) referenced in function "public: static int __cdecl ofxCLeye::listDevices(void)" (?listDevices#ofxCLeye##SAHXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrameDimensions(void *,int &,int &)" (?CLEyeCameraGetFrameDimensions##YA_NPAXAAH1#Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame#ofxCLeye##QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraGetFrame(void *,unsigned char *,int)" (?CLEyeCameraGetFrame##YA_NPAXPAEH#Z) referenced in function "public: void __thiscall ofxCLeye::grabFrame(void)" (?grabFrame#ofxCLeye##QAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeDestroyCamera(void *)" (?CLEyeDestroyCamera##YA_NPAX#Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close#ofxCLeye##UAEXXZ)
2>ofxCLeye.obj : error LNK2019: unresolved external symbol "bool __cdecl CLEyeCameraStop(void *)" (?CLEyeCameraStop##YA_NPAX#Z) referenced in function "public: virtual void __thiscall ofxCLeye::close(void)" (?close#ofxCLeye##UAEXXZ)
... etc etc...
2>bin\clEye_debug.exe : fatal error LNK1120: 10 unresolved externals
I imagine that the compiler is trying to link CLEyeMulticam.lib but not finding it. I think that I have configured it properly.
Could you point me with the needed steps to include a library in VS2010 ?
Thank you,
marc
Apologies if this is overly pedantic. If this is a pre-built library (not built as part of the project/solution) then make sure you
a) #include the correct header
b) #define any requisite macros
c) speciy additional .lib dependencies as shown below.
You will need to specify a fully qualifed path (d:\src\project\libs\camera.lib) unless the libary file is in the LIB environment variable.
In the Property Pages for your project, navigate to Configuration > Linker > Input and add the lib file to the Additional Dependencies setting. This applies to VC++ 2008, probably likewise to 2010.