I'm developing a small Application using a QWidget and statically linking Qt 5.6. I'm using VS12 at moment.
#include <QMainWindow>
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow w;
w.show();
return a.exec();
}
It compiles fine but I'm getting linker errors.
1>libGLESv2d.lib(global_state.obj) : error LNK2019: unresolved external symbol "unsigned long __cdecl CreateTLSIndex(void)" (?CreateTLSIndex##YAKXZ) referenced in function "struct A0x6526a104::Current * __cdecl `anonymous namespace'::GetCurrentData(void)" (?GetCurrentData#?A0x6526a104##YAPAUCurrent#1#XZ)
1>libGLESv2d.lib(global_state.obj) : error LNK2019: unresolved external symbol "bool __cdecl DestroyTLSIndex(unsigned long)" (?DestroyTLSIndex##YA_NK#Z) referenced in function _DllMain_ANGLE#12
1>libGLESv2d.lib(global_state.obj) : error LNK2019: unresolved external symbol "bool __cdecl SetTLSValue(unsigned long,void *)" (?SetTLSValue##YA_NKPAX#Z) referenced in function "struct A0x6526a104::Current * __cdecl `anonymous namespace'::AllocateCurrent(void)" (?AllocateCurrent#?A0x6526a104##YAPAUCurrent#1#XZ)
1>libGLESv2d.lib(global_state.obj) : error LNK2019: unresolved external symbol "void * __cdecl GetTLSValue(unsigned long)" (?GetTLSValue##YAPAXK#Z) referenced in function "void __cdecl `anonymous namespace'::DeallocateCurrent(void)" (?DeallocateCurrent#?A0x6526a104##YAXXZ)
1>libGLESv2d.lib(Program.obj) : error LNK2019: unresolved external symbol "bool __cdecl sh::InterpolationTypesMatch(enum sh::InterpolationType,enum sh::InterpolationType)" (?InterpolationTypesMatch#sh##YA_NW4InterpolationType#1#0#Z) referenced in function "private: static bool __cdecl gl::Program::linkValidateVaryings(class gl::InfoLog &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct sh::Varying const &,struct sh::Varying const &)" (?linkValidateVaryings#Program#gl##CA_NAAVInfoLog#2#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABUVarying#sh##2#Z)
1>libGLESv2d.lib(Program.obj) : error LNK2019: unresolved external symbol "public: struct sh::ShaderVariable & __thiscall sh::ShaderVariable::operator=(struct sh::ShaderVariable const &)" (??4ShaderVariable#sh##QAEAAU01#ABU01##Z) referenced in function "private: bool __thiscall gl::Program::linkAttributes(class gl::InfoLog &,class gl::AttributeBindings const &,class gl::Shader const *)" (?linkAttributes#Program#gl##AAE_NAAVInfoLog#2#ABVAttributeBindings#2#PBVShader#2##Z)
1>libGLESv2d.lib(Program.obj) : error LNK2019: unresolved external symbol "public: __thiscall sh::Attribute::Attribute(void)" (??0Attribute#sh##QAE#XZ) referenced in function "public: __thiscall gl::Program::Program(class rx::ProgramImpl *,class gl::ResourceManager *,unsigned int)" (??0Program#gl##QAE#PAVProgramImpl#rx##PAVResourceManager#1#I#Z)
1>libGLESv2d.lib(Program.obj) : error LNK2019: unresolved external symbol "public: __thiscall sh::Attribute::~Attribute(void)" (??1Attribute#sh##QAE#XZ) referenced in function "public: __thiscall gl::Program::Program(class rx::ProgramImpl *,class gl::ResourceManager *,unsigned int)" (??0Program#gl##QAE#PAVProgramImpl#rx##PAVResourceManager#1#I#Z)
1>libGLESv2d.lib(ProgramImpl.obj) : error LNK2001: unresolved external symbol "public: __thiscall sh::Attribute::~Attribute(void)" (??1Attribute#sh##QAE#XZ)
1>libGLESv2d.lib(Program.obj) : error LNK2019: unresolved external symbol "public: struct sh::Attribute & __thiscall sh::Attribute::operator=(struct sh::Attribute const &)" (??4Attribute#sh##QAEAAU01#ABU01##Z) referenced in function "void __cdecl std::_Fill<struct sh::Attribute *,struct sh::Attribute>(struct sh::Attribute *,struct sh::Attribute *,struct sh::Attribute const &)" (??$_Fill#PAUAttribute#sh##U12##std##YAXPAUAttribute#sh##0ABU12##Z)
I have included the following libs:
winmm.lib
imm32.lib
Ws2_32.lib
opengl32.lib
Qt5Guid.lib
Qt5Widgetsd.lib
qtpcred.lib
qtharfbuzzngd.lib
Qt5PlatformSupportd.lib
qwindowsd.lib
libEGLd.lib
libGLESv2d.lib
qtfreetyped.lib
Qt5Cored.lib
And the funny thing is that if use QtCreator it compiles,links and runs just fine.
What I saw is that QtCreator adds the following compile flags:
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_OPENGL_ES_2 -DQT_OPENGL_ES_2_ANGLE -DQT_OPENGL_ES_2_ANGLE_STATIC -DGL_APICALL= -DEGLAPI=
I tried them in my project but it does not change anything.
What am I missing? What do I need to make the program link?
I found it. This is the list of libs you need to make it work:
winmm.lib
imm32.lib
Ws2_32.lib
Qt5Guid.lib
Qt5Widgetsd.lib
qtpcred.lib
qtharfbuzzngd.lib
Qt5PlatformSupportd.lib
qwindowsd.lib
libEGLd.lib
libGLESv2d.lib
qtfreetyped.lib
Qt5Cored.lib
+ preprocessord.lib
+ translatord.lib
+ d3d9.lib
+ dxguid.lib
opengl32.lib is not needed.
I still have no idea why QtCreator knows what libs are needed and why VS2013 does not.
Thanks for your help.
As far as I can tell the linker is complaining about this line of code. Looking at what that file is including seems to suggest dependence on libANGLE.
After a lot of Googling I found that CreateTLS() seems to be defined in libANGLE common, which can be found here.
I'm not sure in which particular Lib or DLL those definitions end up but looking into the build scripts would definitely reveal it (sorry, I don't have time to do that atm). But the symbols in the original question are definitely in one of the Libs provided by libANGLE.
this page suggests that all you need to do is add libEGLd.lib and libGLESv2.lib to your linker line, which is already the case, but you should check that you also have the DLLs too. Note point 3, quoted from the linked page, below:
Copy libEGL.dll and libGLESv2.dll from the build output directory (see Building ANGLE) into your application folder.
If you add the DLLs to your solution you can automate copying them to the destination directory..
Related
I am trying to do Catch2 Unit Testing in Visual Studio. I have created a small test project to practice. When I try to compile this test project, I get a linker error. I am now trying to diagnose this linker error, but the Catch2.hpp header file contains thousands of lines of code. My hope is that someone who is more familiar with Catch2 or unit testing in general can diagnose what the issue is.
I will describe the process by which I created this project. I created a new project in a new solution. I have 4 files, all in the same directory, listed below.
The class I want to test:
//a.h
#pragma once
class A {
friend int A_Tester_Func1(A a);
public:
A(int num) : my_num_(num) {
}
private:
int my_num_;
};
The test:
//atester.cpp
#pragma once
#include "catch.hpp"
#include "a.h"
int A_Tester_Func1(A a) {
return a.my_num_;
}
TEST_CASE("a contains a positive integer", "[a]") {
//...
A a(3);
REQUIRE(A_Tester_Func1(a) == 3);
}
The main function that runs the tests:
//tester.cpp
#define CATCH_CONFIG_MAIN
#include "catch.hpp" // this should create the main function
The Catch2 Testing Framework:
// catch.hpp
/*
* Catch v2.13.2
* Generated: 2020-10-07 11:32:53.302017
*/
//~17-18k lines of code that from Catch2
#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED
When I try to compile this code in Visual Studio using the Local Windows Debugger button, I get a bunch of Unresolved External Symbol linker errors. I believe I read somewhere that Catch2 is "partially compiled." That may have something to do with it, but I don't know. Following this guide (StackOverflow: Best practices for Unit testing with Catch2 in Visual Studio) has worked for me, but I'm trying to understand why the small example above is not successfully linking.
I have included the linker errors below for completeness, although I feel that they will probably not be necessary for the question.
1>atester.obj : error LNK2019: unresolved external symbol "public: __thiscall Catch::StringRef::StringRef(char const *)" (??0StringRef#Catch##QAE#PBD#Z) referenced in function "public: class Catch::BinaryExpr<int const &,int const &> const __thiscall Catch::ExprLhs<int const &>::operator==<int>(int const &)" (??$?8H#?$ExprLhs#ABH#Catch##QAE?BV?$BinaryExpr#ABHABH#1#ABH#Z)
1>atester.obj : error LNK2019: unresolved external symbol "struct Catch::ITestInvoker * __cdecl Catch::makeTestInvoker(void (__cdecl*)(void))" (?makeTestInvoker#Catch##YAPAUITestInvoker#1#P6AXXZ#Z) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'autoRegistrar1''(void)" (??__EautoRegistrar1#?A0xf9ca9c7d##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: __thiscall Catch::NameAndTags::NameAndTags(class Catch::StringRef const &,class Catch::StringRef const &)" (??0NameAndTags#Catch##QAE#ABVStringRef#1#0#Z) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'autoRegistrar1''(void)" (??__EautoRegistrar1#?A0xf9ca9c7d##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: __thiscall Catch::AutoReg::AutoReg(struct Catch::ITestInvoker *,struct Catch::SourceLineInfo const &,class Catch::StringRef const &,struct Catch::NameAndTags const &)" (??0AutoReg#Catch##QAE#PAUITestInvoker#1#ABUSourceLineInfo#1#ABVStringRef#1#ABUNameAndTags#1##Z) referenced in function "void __cdecl `anonymous namespace'::`dynamic initializer for 'autoRegistrar1''(void)" (??__EautoRegistrar1#?A0xf9ca9c7d##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Catch::AutoReg::~AutoReg(void)" (??1AutoReg#Catch##UAE#XZ) referenced in function "void __cdecl `anonymous namespace'::`dynamic atexit destructor for 'autoRegistrar1''(void)" (??__FautoRegistrar1#?A0xf9ca9c7d##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: static class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Catch::StringMaker<int,void>::convert(int)" (?convert#?$StringMaker#HX#Catch##SA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##H#Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __cdecl Catch::Detail::stringify<int>(int const &)" (??$stringify#H#Detail#Catch##YA?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##ABH#Z)
1>atester.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Catch::ITransientExpression::~ITransientExpression(void)" (??1ITransientExpression#Catch##UAE#XZ) referenced in function "public: virtual __thiscall Catch::BinaryExpr<int const &,int const &>::~BinaryExpr<int const &,int const &>(void)" (??1?$BinaryExpr#ABHABH#Catch##UAE#XZ)
1>atester.obj : error LNK2019: unresolved external symbol "void __cdecl Catch::formatReconstructedExpression(class std::basic_ostream<char,struct std::char_traits<char> > &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class Catch::StringRef,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?formatReconstructedExpression#Catch##YAXAAV?$basic_ostream#DU?$char_traits#D#std###std##ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##3#VStringRef#1#1#Z) referenced in function "private: virtual void __thiscall Catch::BinaryExpr<int const &,int const &>::streamReconstructedExpression(class std::basic_ostream<char,struct std::char_traits<char> > &)const " (?streamReconstructedExpression#?$BinaryExpr#ABHABH#Catch##EBEXAAV?$basic_ostream#DU?$char_traits#D#std###std###Z)
1>atester.obj : error LNK2019: unresolved external symbol "public: __thiscall Catch::AssertionHandler::AssertionHandler(class Catch::StringRef const &,struct Catch::SourceLineInfo const &,class Catch::StringRef,enum Catch::ResultDisposition::Flags)" (??0AssertionHandler#Catch##QAE#ABVStringRef#1#ABUSourceLineInfo#1#V21#W4Flags#ResultDisposition#1##Z) referenced in function "void __cdecl ____C_A_T_C_H____T_E_S_T____0(void)" (?____C_A_T_C_H____T_E_S_T____0##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: void __thiscall Catch::AssertionHandler::handleExpr(struct Catch::ITransientExpression const &)" (?handleExpr#AssertionHandler#Catch##QAEXABUITransientExpression#2##Z) referenced in function "void __cdecl ____C_A_T_C_H____T_E_S_T____0(void)" (?____C_A_T_C_H____T_E_S_T____0##YAXXZ)
1>atester.obj : error LNK2019: unresolved external symbol "public: void __thiscall Catch::AssertionHandler::handleUnexpectedInflightException(void)" (?handleUnexpectedInflightException#AssertionHandler#Catch##QAEXXZ) referenced in function __catch$?____C_A_T_C_H____T_E_S_T____0##YAXXZ$0
1>atester.obj : error LNK2019: unresolved external symbol "public: void __thiscall Catch::AssertionHandler::complete(void)" (?complete#AssertionHandler#Catch##QAEXXZ) referenced in function __catch$?____C_A_T_C_H____T_E_S_T____0##YAXXZ$0
1>MSVCRTD.lib(exe_main.obj) : error LNK2019: unresolved external symbol _main referenced in function "int __cdecl invoke_main(void)" (?invoke_main##YAHXZ)
What is causing these errors? How do I fix these errors while keeping catch.hpp in the same project as my source files?
In a .cpp file, add this to make the project a Catch2 test runner:
#define CATCH_CONFIG_RUNNER
#include "catch.hpp"
Read more at Supplying main() yourself
I ran into the same problem.
You need to keep #define CATCH_CONFIG_MAIN in the first line of the file, especially before other #include.
atester.cpp must not have the #pragma once directive. It's for header files, and while it may not be your source of trouble, it simply doesn't belong. Since you're not providing enough detail (namely: where's the minimized project file?), I have to be conservative here.
It seems that tester.cpp is not part of the project that you're building. Just because it's a file that exists on disk doesn't mean it's automatically picked up. You have to manually add it to the MSVC project. That's all there's to it. I use Catch2 with MSVS all the time and that's all it takes to make it work.
Trying to make a program cross-platform, QT is required to be linked statically. I am struggling with dependencies.
After several hours researching, I managed to get the dependencies missing down to the following errors, for which I could not find much information around.
As an additional information, I could not include Qt5PlatformSupport, which does not seems to exists in Qt 5.12.2
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: static class QWindowsUiaWrapper * __cdecl QWindowsUiaWrapper::instance(void)" (?instance#QWindowsUiaWrapper##SAPAV1#XZ) referenced in function "public: static bool __cdecl QWindowsUiaAccessibility::handleWmGetObject(struct HWND__ *,unsigned int,long,long *)" (?handleWmGetObject#QWindowsUiaAccessibility##SA_NPAUHWND__##IJPAJ#Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: int __thiscall QWindowsUiaWrapper::ready(void)" (?ready#QWindowsUiaWrapper##QAEHXZ) referenced in function "public: virtual void __thiscall QWindowsUiaAccessibility::notifyAccessibilityUpdate(class QAccessibleEvent *)" (?notifyAccessibilityUpdate#QWindowsUiaAccessibility##UAEXPAVQAccessibleEvent###Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: int __thiscall QWindowsUiaWrapper::clientsAreListening(void)" (?clientsAreListening#QWindowsUiaWrapper##QAEHXZ) referenced in function "public: virtual void __thiscall QWindowsUiaAccessibility::notifyAccessibilityUpdate(class QAccessibleEvent *)" (?notifyAccessibilityUpdate#QWindowsUiaAccessibility##UAEXPAVQAccessibleEvent###Z)
qwindowsd.lib(qwindowsuiaaccessibility.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::returnRawElementProvider(struct HWND__ *,unsigned int,long,struct IRawElementProviderSimple *)" (?returnRawElementProvider#QWindowsUiaWrapper##QAEJPAUHWND__##IJPAUIRawElementProviderSimple###Z) referenced in function "public: static bool __cdecl QWindowsUiaAccessibility::handleWmGetObject(struct HWND__ *,unsigned int,long,long *)" (?handleWmGetObject#QWindowsUiaAccessibility##SA_NPAUHWND__##IJPAJ#Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::hostProviderFromHwnd(struct HWND__ *,struct IRawElementProviderSimple * *)" (?hostProviderFromHwnd#QWindowsUiaWrapper##QAEJPAUHWND__##PAPAUIRawElementProviderSimple###Z) referenced in function "public: virtual long __stdcall QWindowsUiaMainProvider::get_HostRawElementProvider(struct IRawElementProviderSimple * *)" (?get_HostRawElementProvider#QWindowsUiaMainProvider##UAGJPAPAUIRawElementProviderSimple###Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::raiseAutomationPropertyChangedEvent(struct IRawElementProviderSimple *,int,struct tagVARIANT,struct tagVARIANT)" (?raiseAutomationPropertyChangedEvent#QWindowsUiaWrapper##QAEJPAUIRawElementProviderSimple##HUtagVARIANT##1#Z) referenced in function "public: static void __cdecl QWindowsUiaMainProvider::notifyStateChange(class QAccessibleStateChangeEvent *)" (?notifyStateChange#QWindowsUiaMainProvider##SAXPAVQAccessibleStateChangeEvent###Z)
qwindowsd.lib(qwindowsuiamainprovider.obj):-1: error: LNK2019: unresolved external symbol "public: long __thiscall QWindowsUiaWrapper::raiseAutomationEvent(struct IRawElementProviderSimple *,int)" (?raiseAutomationEvent#QWindowsUiaWrapper##QAEJPAUIRawElementProviderSimple##H#Z) referenced in function "public: static void __cdecl QWindowsUiaMainProvider::notifyFocusChange(class QAccessibleEvent *)" (?notifyFocusChange#QWindowsUiaMainProvider##SAXPAVQAccessibleEvent###Z)
What library is required to fulfill those symbols?
Helpful questions related to this, which did not help:
QT 5.6 static unresolved external symbol
Statically linked app with Qt gives error: Failed to load platform plugin "windows"
Qt static linking and deployment
I use a smaller list of libraries, you may refer to it:
Qt5Core.lib
Qt5Gui.lib
Qt5Widgets.lib
Qt5ThemeSupport.lib
Qt5WindowsUiAutomationSupport.lib
Qt5EventDispatcherSupport.lib
Qt5FontDatabaseSupport.lib
qtmain.lib
qwindows.lib
qtpcre2.lib
qtlibpng.lib
qtharfbuzz.lib
Ws2_32.lib
Imm32.lib
WinMM.lib
Version.lib
Netapi32.lib
Userenv.lib
Dwmapi.lib
Simple and stupid: I was missing the Qt5WindowsUIAutomationSupport library.
I keep it as answer if anybody face the same issue.
In general, I had to include following libraries:
Qt5AccessibilitySupport
Qt5WindowsUiAutomationSupport
Qt5ThemeSupport
Qt5FontDatabaseSupport
qtpre2
qtharfbuzz
qtlibpng
qtfreetype
Qt5EventDispatcherSupport
Dwmapi
imm32
netapi32
wtsapi32
winmm
zlib
bcrypt
version
userenv
And additionally, it is required to startup the platform plugins before the QApplication creation:
#include <QtPlugin>
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)
Using this tutorial, I'm trying to merge the different vectors that were created using opencv_createsamples so that I can do some haartraining.
I'm compiling mergevec.cpp using the VS 2010 command line interface:
cl /EHsc mergevec.cpp
But I get 10 unresolved externals errors, here:
/out:mergevec.exe
mergevec.obj
mergevec.obj : error LNK2019: unresolved external symbol _cvFree_ referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvReleaseMat referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int*,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvShowImage referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol "void __cdecl icvWriteVecSample(struct _iobuf *,void *)" (?icvWriteVecSample##YAXPAU_iobuf##PAX#Z) referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol "int __cdecl icvGetHaar
TraininDataFromVecCallback(struct CvMat *,void *)" (?icvGetHaarTraininDataFromVecCallback##YAHPAUCvMat##PAX#Z) referenced in function "void __cdecl icvAppendVec (struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvV
ecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvCreateMat referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvAlloc referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *, int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol _cvNamedWindow referenced in function "void __cdecl icvAppendVec(struct CvVecFile &,struct CvVecFile &,int *,int,int)" (?icvAppendVec##YAXAAUCvVecFile##0PAHHH#Z)
mergevec.obj : error LNK2019: unresolved external symbol "void __cdecl icvWriteV
ecHeader(struct _iobuf *,int,int,int)" (?icvWriteVecHeader##YAXPAU_iobuf##HHH#Z) referenced in function "void __cdecl icvMergeVecs(char *,char const *,int,int,int)" (?icvMergeVecs##YAXPADPBDHHH#Z)
mergevec.exe : fatal error LNK1120: 10 unresolved externals
How can I fix these problems? Do I need to get some .dlls?
I've been struggling with getting mergevec to work, on different machines, for 2 days! Is the problem that this is old?
By the way, I changed all references in the code from "cv.h" to "opencv.h", since that's the current header file's name.
I'm trying to compile mergevec.cpp in a folder with the following structure:
opencv/
opencv2/
CMakeLists.txt
createsamples.cpp
cvboost.cpp
cvclassifier.h
cvcommon.cpp
cvhaarclassifier.cpp
cvhaartraining.cpp
cvhaartraining.h
cvsamples.cpp
cxcore.h
cxmisc.h
haartraining.cpp
mergevec.cpp
opencv.hpp
performance.cpp
_cvcommon.h
_cvhaartraining.h
The folder opencv2 has directories: core, highgui, flann, contrib etc etc.
Edit
Based on your comments, I've changed the command to include the libraries:
cl /EHsc mergevec.cpp
C:\opencv\build\x64\vc10\lib\opencv_core247d.lib
C:\opencv\build\x64\vc10\lib\opencv_highgui247d.lib
C:\opencv\build\x64\vc10\lib\opencv_flann247d.lib
C:\opencv\build\x64\vc10\lib\opencv_imgproc247d.lib
But it's still showing the same 10 unresolved externals. In desperation I even tried including every single library file, but no difference.
Visual Studio doesn't seems to find the OpenCV library, it seems like a pkg-config missing problem. Check for this as i am not sure how it works on windows. Do you have linked the OpenCV library in your project properties?
Otherwise if it still doesn't work on VS i suggest you to compile it under Linux (WM or not). Check this post for further informations.
I'm having some problems with using CEF in my application which uses the MD/MDd runtime library linking.
I have downloaded the latest build of CEF3 from cefbuilds.com and followed the instructions How to link CEF against a different run-time library.
I have built the "libcef_dll_wrapper" project after changing "Runtime Library" to "/MDd" and "Platform Toolset" to "v110" and then I've linked the resulting "libcef_dll_wrapper.lib" binary to my project.
However, when I try to build my project I get the following errors:
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf16_clear referenced in function "public: static void __cdecl CefBrowserSettingsTraits::clear(struct _cef_browser_settings_t *)" (?clear#CefBrowserSettingsTraits##SAXPAU_cef_browser_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_utf8_to_utf16 referenced in function "public: static bool __cdecl CefStringTraitsUTF16::from_string(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,struct _cef_string_utf16_t *)" (?from_string#CefStringTraitsUTF16##SA_NABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAU_cef_string_utf16_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol _cef_string_list_free referenced in function "public: static void __cdecl CefSettingsTraits::clear(struct _cef_settings_t *)" (?clear#CefSettingsTraits##SAXPAU_cef_settings_t###Z)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "public: static bool __cdecl CefBrowser::CreateBrowser(class CefWindowInfo &,class CefRefPtr<class CefClient>,class CefStringBase<struct CefStringTraitsUTF16> const &,class CefStructBase<struct CefBrowserSettingsTraits> const &)" (?CreateBrowser#CefBrowser##SA_NAAVCefWindowInfo##V?$CefRefPtr#VCefClient####ABV?$CefStringBase#UCefStringTraitsUTF16####ABV?$CefStructBase#UCefBrowserSettingsTraits#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>html.lib(html_producer.obj) : error LNK2019: unresolved external symbol "bool __cdecl CefInitialize(class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z) referenced in function "public: void __thiscall caspar::html::html_producer::run(void)" (?run#html_producer#html#caspar##QAEXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_execute_process referenced in function "int __cdecl CefExecuteProcess(class CefMainArgs const &,class CefRefPtr<class CefApp>)" (?CefExecuteProcess##YAHABVCefMainArgs##V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_initialize referenced in function "bool __cdecl CefInitialize(class CefMainArgs const &,class CefStructBase<struct CefSettingsTraits> const &,class CefRefPtr<class CefApp>)" (?CefInitialize##YA_NABVCefMainArgs##ABV?$CefStructBase#UCefSettingsTraits####V?$CefRefPtr#VCefApp#####Z)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_shutdown referenced in function "void __cdecl CefShutdown(void)" (?CefShutdown##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_do_message_loop_work referenced in function "void __cdecl CefDoMessageLoopWork(void)" (?CefDoMessageLoopWork##YAXXZ)
12>libcef_dll_wrapper.lib(libcef_dll_wrapper.obj) : error LNK2019: unresolved external symbol __imp__cef_run_message_loop referenced in function "void __cdecl CefRunMessageLoop(void)" (?CefRunMessageLoop##YAXXZ)
The full log can be found here.
Any ideas as to what I might be missing?
Are you also libcef.lib in the linker input?
I'm trying to get a simple example working using gSoap, for VS2008.
I've done the following:
wsdl2h -o Init.h http://myservices/InitalisationService.asmx?WSDL
And then this:
soapcpp2 -I "C:\3pSDK\gsoap-2.7\gsoap\import" -i -C -limport Init.h
which produces many files. My project folder looks like this:
// generated files
Init.h
InitalisationServiceSoap.initalizePlayer.req.xml
InitalisationServiceSoap.initalizePlayer.res.xml
InitalisationServiceSoap.nsmap
InitalisationServiceSoap12.initalizePlayer.req.xml
InitalisationServiceSoap12.initalizePlayer.res.xml
InitalisationServiceSoap12.nsmap
ortC.cpp
ortH.h
ortInitalisationServiceSoap12Proxy.cpp
ortInitalisationServiceSoap12Proxy.h
ortInitalisationServiceSoapProxy.cpp
ortInitalisationServiceSoapProxy.h
ortMatlab.c
ortMatlab.h
ortStub.h
// Project Files
ReadMe.txt
stdafx.cpp
stdafx.h
WebServicesClient.cpp
WebServicesClient.vcproj
targetver.h
// files added to the project from gSoap folder
stdsoap2.cpp
stdsoap2.h
typemap.dat
When I build, I get a lot of linker errors (unresolved externals). I can't find anything to link against (e.g. no binary libraries) - what am I missing?
I believe that this may have something to do with the following from the docs:
To complete the build, compile and
link the generated soapC.cpp,
soapcalcProxy.cpp, and the run-time
gSOAP engine -lgsoap++ (or use source
stdsoap2.cpp in case libgsoap++.a is
not installed) with your code.
is there a gsoap++ library for win32?
1>Compiling...
1>WebServicesClient.cpp
1>ortC.cpp
1>Generating Code...
1>Linking...
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_faultcode referenced in function _http_response
1>stdsoap2.obj : error LNK2001: unresolved external symbol _namespaces
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_getheader referenced in function _soap_recv_header
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_faultsubcode referenced in function _soap_set_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_faultstring referenced in function _soap_set_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_putfault referenced in function _soap_send_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_putheader referenced in function _soap_send_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_serializefault referenced in function _soap_send_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_serializeheader referenced in function _soap_send_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_getfault referenced in function _soap_recv_fault
1>stdsoap2.obj : error LNK2019: unresolved external symbol _soap_faultdetail referenced in function _soap_set_error
1>ortC.obj : error LNK2019: unresolved external symbol "void * __cdecl soap_class_id_enter(struct soap *,char const *,void *,int,unsigned int,char const *,char const *)" (?soap_class_id_enter##YAPAXPAUsoap##PBDPAXHI11#Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * __cdecl soap_in_std__string(struct soap *,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,char const *)" (?soap_in_std__string##YAPAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAUsoap##PBDPAV12#1#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_putindependent(struct soap *)" (?soap_putindependent##YAHPAUsoap###Z) referenced in function "int __cdecl soap_put_std__string(struct soap *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const *,char const *,char const *)" (?soap_put_std__string##YAHPAUsoap##PBV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PBD2#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_getindependent(struct soap *)" (?soap_getindependent##YAHPAUsoap###Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * __cdecl soap_get_std__string(struct soap *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,char const *,char const *)" (?soap_get_std__string##YAPAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAUsoap##PAV12#PBD2#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_fdelete(struct soap_clist *)" (?soap_fdelete##YAHPAUsoap_clist###Z) referenced in function "class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > * __cdecl soap_instantiate_std__string(struct soap *,int,char const *,char const *,unsigned int *)" (?soap_instantiate_std__string##YAPAV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##PAUsoap##HPBD1PAI#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "void __cdecl soap_default_int(struct soap *,int *)" (?soap_default_int##YAXPAUsoap##PAH#Z) referenced in function "public: virtual void __thiscall _ns1__initalizePlayerResponse::soap_default(struct soap *)" (?soap_default#_ns1__initalizePlayerResponse##UAEXPAUsoap###Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_out_int(struct soap *,char const *,int,int const *,char const *)" (?soap_out_int##YAHPAUsoap##PBDHPBH1#Z) referenced in function "int __cdecl soap_out__ns1__initalizePlayerResponse(struct soap *,char const *,int,class _ns1__initalizePlayerResponse const *,char const *)" (?soap_out__ns1__initalizePlayerResponse##YAHPAUsoap##PBDHPBV_ns1__initalizePlayerResponse##1#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int __cdecl soap_ignore_element(struct soap *)" (?soap_ignore_element##YAHPAUsoap###Z) referenced in function "class _ns1__initalizePlayerResponse * __cdecl soap_in__ns1__initalizePlayerResponse(struct soap *,char const *,class _ns1__initalizePlayerResponse *,char const *)" (?soap_in__ns1__initalizePlayerResponse##YAPAV_ns1__initalizePlayerResponse##PAUsoap##PBDPAV1#1#Z)
1>ortC.obj : error LNK2019: unresolved external symbol "int * __cdecl soap_in_int(struct soap *,char const *,int *,char const *)" (?soap_in_int##YAPAHPAUsoap##PBDPAH1#Z) referenced in function "class _ns1__initalizePlayerResponse * __cdecl soap_in__ns1__initalizePlayerResponse(struct soap *,char const *,class _ns1__initalizePlayerResponse *,char const *)" (?soap_in__ns1__initalizePlayerResponse##YAPAV_ns1__initalizePlayerResponse##PAUsoap##PBDPAV1#1#Z)
1>G:\Prototypes\WebServicesClient\Debug\WebServicesClient.exe : fatal error LNK1120: 19 unresolved externals
1>Build log was saved at "file://g:\Prototypes\WebServicesClient\WebServicesClient\Debug\BuildLog.htm"
1>WebServicesClient - 20 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Okay, for those frustrated with the docs on the gSoap site, using VS2008 to compile a quick client only example, here's the steps (servers are different).
Generate the header file from the WSDL:
wsdl2h -o Init.h http://bleh.com/myservice.asmx?WSDL
Generate the soap client files:
soapcpp2 -C -IC:\3pSDK\gsoap-2.7\gsoap\import Init.h
Ensure you add the following files to your solution for build:
soapC.cpp, soapClient.cpp, and stdsoap2.cpp
Ensure that, for each of these files, you select the compiler option "Not using Pre-Compiled headers". (file Properties -> C++ -> Precompiled Headers -> Create/Use Precompiled header).
Finally, add the .nsmap file generated for your proxy to the stdafx.h (or in your main if your project isn't using pre-compiled headers).
Here's a sample that makes a simple query:
// WebServicesClient.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include "init/soapInitServiceSoapProxy.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
std::string user = "AAAA";
std::string pass = "BBBB";
InitServiceSoap service;
_ns1__initPlayer query;
_ns1__initPlayerResponse ans;
query.psParam1 = &user;
query.psParam2 = &pass;
if( service.__ns2__initPlayer(&query, &ans) == SOAP_OK )
{
cout << "success!" << endl;
}
cin.get();
return 0;
}
hope this helps someone!