recently I'm working on a UE5 project that uses filesystem to read and render a .obj file directly from a given path, but my code generates 58 LNK2019 errors around the read file process after compiling it. I have tried many possible solutions like #include everything that I may need. However, the LNK2019 still exists.
Then I comment everything out of my file and I found that even if my .cpp and .h are empty but have #include <filesystem> it causes 5 LNK2019 errors. When I delete this file and create another one, then include it, it happens again. I didn't found what the compiler version of UE5 working set is, but it's said to be C++17
Basically this is my .cpp
#include "OBJMeshComponent.h"
//yes literally just one line.
and this is my .h
#pragma once
#include "CoreMinimal.h"
#include "ProceduralMeshComponent.h"
#include <fstream>
#include <iostream>
#include <filesystem> // this causes 5 LNK2019
#include "OBJMeshComponent.generated.h"
UCLASS()
class PROJECT_API UOBJMeshComponent : public UProceduralMeshComponent
{
GENERATED_BODY()
//as you can see it is empty
};
for the build output file:
OBJProceduralMeshComponent.gen.cpp.obj : error LNK2019: 无法解析的外部符号 "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc#std##YAXXZ),函数 "protected: void __cdecl std::time_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Getvals<wchar_t>(wchar_t,class std::_Locinfo const &)" (??$_Getvals#_W#?$time_get#DV?$istreambuf_iterator#DU?$char_traits#D#std###std###std##IEAAX_WAEBV_Locinfo#1##Z) 中引用了该符号
OBJProceduralMeshComponent.cpp.obj : error LNK2001: 无法解析的外部符号 "void __cdecl std::_Xbad_alloc(void)" (?_Xbad_alloc#std##YAXXZ)
OBJProceduralMeshComponent.gen.cpp.obj : error LNK2001: 无法解析的外部符号 _Mbrtowc
OBJProceduralMeshComponent.cpp.obj : error LNK2001: 无法解析的外部符号 _Mbrtowc
OBJProceduralMeshComponent.gen.cpp.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: struct _Cvtvec __cdecl std::_Locinfo::_Getcvt(void)const " (__imp_?_Getcvt#_Locinfo#std##QEBA?AU_Cvtvec##XZ),函数 "protected: void __cdecl std::time_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Getvals<wchar_t>(wchar_t,class std::_Locinfo const &)" (??$_Getvals#_W#?$time_get#DV?$istreambuf_iterator#DU?$char_traits#D#std###std###std##IEAAX_WAEBV_Locinfo#1##Z) 中引用了该符号
OBJProceduralMeshComponent.cpp.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: struct _Cvtvec __cdecl std::_Locinfo::_Getcvt(void)const " (__imp_?_Getcvt#_Locinfo#std##QEBA?AU_Cvtvec##XZ)
OBJProceduralMeshComponent.gen.cpp.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: unsigned short const * __cdecl std::_Locinfo::_W_Getdays(void)const " (__imp_?_W_Getdays#_Locinfo#std##QEBAPEBGXZ),函数 "protected: void __cdecl std::time_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Getvals<wchar_t>(wchar_t,class std::_Locinfo const &)" (??$_Getvals#_W#?$time_get#DV?$istreambuf_iterator#DU?$char_traits#D#std###std###std##IEAAX_WAEBV_Locinfo#1##Z) 中引用了该符号
OBJProceduralMeshComponent.cpp.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: unsigned short const * __cdecl std::_Locinfo::_W_Getdays(void)const " (__imp_?_W_Getdays#_Locinfo#std##QEBAPEBGXZ)
OBJProceduralMeshComponent.gen.cpp.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: unsigned short const * __cdecl std::_Locinfo::_W_Getmonths(void)const " (__imp_?_W_Getmonths#_Locinfo#std##QEBAPEBGXZ),函数 "protected: void __cdecl std::time_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Getvals<wchar_t>(wchar_t,class std::_Locinfo const &)" (??$_Getvals#_W#?$time_get#DV?$istreambuf_iterator#DU?$char_traits#D#std###std###std##IEAAX_WAEBV_Locinfo#1##Z) 中引用了该符号
OBJProceduralMeshComponent.cpp.obj : error LNK2001: 无法解析的外部符号 "__declspec(dllimport) public: unsigned short const * __cdecl std::_Locinfo::_W_Getmonths(void)const " (__imp_?_W_Getmonths#_Locinfo#std##QEBAPEBGXZ)
C:\Users\liuyi\Documents\Unreal Projects\Assignment2\Binaries\Win64\UnrealEditor-Assignment2.patch_0.exe : fatal error LNK1120: 5 个无法解析的外部命令
Related
I have built icu 64.2 (debug and release for both x86 and x64). My build passes all the tests, so I know icu is not the issue.
I have also built a 64-bit version of boost 1.70.0 using the following b2 build command:
b2 address-model=64 -sICU_PATH=C:\icu-release-64-2\icu4c threading=multi --build-type=complete --toolset=msvc-14.1 -j 6
b2 is detecting my icu build and is showing:
- has_icu builds : yes
When I try to build my project with this boost/regex/icu code:
bool is_valid_password(const icu::UnicodeString& password, const icu::UnicodeString& requirements)
{
return boost::u32regex_match(password, boost::make_u32regex(requirements));
}
I get the following error:
1>------ Build started: Project: URLParser, Configuration: Debug x64 ------
1>URLParser.obj : error LNK2019: unresolved external symbol u_tolower_64 referenced in function "public: int __cdecl boost::icu_regex_traits::translate_nocase(int)const " (?translate_nocase#icu_regex_traits#boost##QEBAHH#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2001: unresolved external symbol u_tolower_64
1>URLParser.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: int __cdecl icu_64::UnicodeString::length(void)const " (__imp_?length#UnicodeString#icu_64##QEBAHXZ) referenced in function "class boost::basic_regex<int,class boost::icu_regex_traits> __cdecl boost::make_u32regex(class icu_64::UnicodeString const &,unsigned int)" (?make_u32regex#boost##YA?AV?$basic_regex#HVicu_regex_traits#boost###1#AEBVUnicodeString#icu_64##I#Z)
1>URLParser.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: char16_t const * __cdecl icu_64::UnicodeString::getBuffer(void)const " (__imp_?getBuffer#UnicodeString#icu_64##QEBAPEB_SXZ) referenced in function "class boost::basic_regex<int,class boost::icu_regex_traits> __cdecl boost::make_u32regex(class icu_64::UnicodeString const &,unsigned int)" (?make_u32regex#boost##YA?AV?$basic_regex#HVicu_regex_traits#boost###1#AEBVUnicodeString#icu_64##I#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol u_isblank_64 referenced in function "public: bool __cdecl boost::icu_regex_traits::isctype(int,unsigned __int64)const " (?isctype#icu_regex_traits#boost##QEBA_NH_K#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol u_isspace_64 referenced in function "public: unsigned __int64 __cdecl boost::icu_regex_traits::lookup_classname(int const *,int const *)const " (?lookup_classname#icu_regex_traits#boost##QEBA_KPEBH0#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol u_charType_64 referenced in function "public: bool __cdecl boost::icu_regex_traits::isctype(int,unsigned __int64)const " (?isctype#icu_regex_traits#boost##QEBA_NH_K#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol u_charFromName_64 referenced in function "public: class std::vector<int,class std::allocator<int> > __cdecl boost::icu_regex_traits::lookup_collatename(int const *,int const *)const " (?lookup_collatename#icu_regex_traits#boost##QEBA?AV?$vector#HV?$allocator#H#std###std##PEBH0#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol u_digit_64 referenced in function "public: bool __cdecl boost::icu_regex_traits::isctype(int,unsigned __int64)const " (?isctype#icu_regex_traits#boost##QEBA_NH_K#Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_64::Locale::Locale(void)" (__imp_??0Locale#icu_64##QEAA#XZ) referenced in function "public: __cdecl boost::icu_regex_traits::icu_regex_traits(void)" (??0icu_regex_traits#boost##QEAA#XZ)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_64::Locale::Locale(class icu_64::Locale const &)" (__imp_??0Locale#icu_64##QEAA#AEBV01##Z) referenced in function "public: __cdecl boost::re_detail_107000::icu_regex_traits_implementation::icu_regex_traits_implementation(class icu_64::Locale const &)" (??0icu_regex_traits_implementation#re_detail_107000#boost##QEAA#AEBVLocale#icu_64###Z)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl icu_64::Locale::Locale(class icu_64::Locale &&)" (__imp_??0Locale#icu_64##QEAA#$$QEAV01##Z) referenced in function "public: class icu_64::Locale __cdecl boost::basic_regex<int,class boost::icu_regex_traits>::getloc(void)const " (?getloc#?$basic_regex#HVicu_regex_traits#boost###boost##QEBA?AVLocale#icu_64##XZ)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl icu_64::Locale::~Locale(void)" (__imp_??1Locale#icu_64##UEAA#XZ) referenced in function "public: __cdecl boost::icu_regex_traits::icu_regex_traits(void)" (??0icu_regex_traits#boost##QEAA#XZ)
1>libboost_regex-vc141-mt-gd-x64-1_70.lib(icu.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: static class icu_64::Collator * __cdecl icu_64::Collator::createInstance(class icu_64::Locale const &,enum UErrorCode &)" (__imp_?createInstance#Collator#icu_64##SAPEAV12#AEBVLocale#2#AEAW4UErrorCode###Z) referenced in function "public: __cdecl boost::re_detail_107000::icu_regex_traits_implementation::icu_regex_traits_implementation(class icu_64::Locale const &)" (??0icu_regex_traits_implementation#re_detail_107000#boost##QEAA#AEBVLocale#icu_64###Z)
1>C:\Users\nicho\source\repos\URLParser\x64\Debug\URLParser.exe : fatal error LNK1120: 13 unresolved externals
1>Done building project "URLParser.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I should also note that I built icu and boost with the same compiler and MSVC toolset. Any ideas why boost wouldn't be linking to icu?
I have a problem while using BOOST libraries ,
I downloaded boost_1_59_0 installer and install it to "C:\local\boost_1_59_0"
then I added the boost variables as following
click here
while including boost in c++ project using qt creator or visual studio , it shows a lot of errors
CGAL example:
#include <iostream>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/convex_hull_2.h>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::Point_2 Point_2;
int main()
{
Point_2 points[5] = { Point_2(0,0), Point_2(10,0), Point_2(10,10),
Point_2(6,5), Point_2(4,1) };
Point_2 result[5];
Point_2 *ptr = CGAL::convex_hull_2( points, points+5, result );
std::cout << ptr - result << " points on the convex hull" <<
std::endl;
return 0;
}
- in qt-creator , the errors:
here
.pro file :
INCLUDEPATH += C:\local\boost_1_59_0\
C:\dev\CGAL-4.9\include\
C:\dev\CGAL-4.9\auxiliary\gmp\include\
LIBS += C:\dev\CGAL-4.9\auxiliary\gmp\lib\libgmp-10.lib\
C:\local\boost_1_59_0\lib64-msvc-12.0\libboost_thread-vc100-mt-gd-1_51.lib\
C:\local\boost_1_59_0\lib64-msvc-12.0\boost_thread-vc120-mt-1_59.lib\
C:\dev\CGAL-4.9\build\lib\CGAL-vc120-mt-gd-4.9.lib\
- in visual studio , the errors:
1>------ Build started: Project: cgal_test, Configuration: Debug Win32 ------
1>Source.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::system_category(void)" (?system_category#system#boost##YAABVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'native_ecat''(void)" (??__Enative_ecat#system#boost##YAXXZ)
1>Source.obj : error LNK2019: unresolved external symbol "class boost::system::error_category const & __cdecl boost::system::generic_category(void)" (?generic_category#system#boost##YAABVerror_category#12#XZ) referenced in function "void __cdecl boost::system::`dynamic initializer for 'errno_ecat''(void)" (??__Eerrno_ecat#system#boost##YAXXZ)
1>Source.obj : error LNK2019: unresolved external symbol "void __cdecl boost::detail::set_tss_data(void const *,class boost::shared_ptr<struct boost::detail::tss_cleanup_function>,void *,bool)" (?set_tss_data#detail#boost##YAXPBXV?$shared_ptr#Utss_cleanup_function#detail#boost###2#PAX_N#Z) referenced in function "public: __thiscall boost::thread_specific_ptr<class CGAL::Lazy<class CGAL::Interval_nt<0>,class CGAL::Gmpq,class CGAL::Lazy_exact_nt<class CGAL::Gmpq>,struct CGAL::To_interval<class CGAL::Gmpq> > >::~thread_specific_ptr<class CGAL::Lazy<class CGAL::Interval_nt<0>,class CGAL::Gmpq,class CGAL::Lazy_exact_nt<class CGAL::Gmpq>,struct CGAL::To_interval<class CGAL::Gmpq> > >(void)" (??1?$thread_specific_ptr#V?$Lazy#V?$Interval_nt#$0A##CGAL##VGmpq#2#V?$Lazy_exact_nt#VGmpq#CGAL###2#U?$To_interval#VGmpq#CGAL###2##CGAL###boost##QAE#XZ)
1>Source.obj : error LNK2019: unresolved external symbol "void * __cdecl boost::detail::get_tss_data(void const *)" (?get_tss_data#detail#boost##YAPAXPBX#Z) referenced in function "public: class CGAL::Lazy<class CGAL::Interval_nt<0>,class CGAL::Gmpq,class CGAL::Lazy_exact_nt<class CGAL::Gmpq>,struct CGAL::To_interval<class CGAL::Gmpq> > * __thiscall boost::thread_specific_ptr<class CGAL::Lazy<class CGAL::Interval_nt<0>,class CGAL::Gmpq,class CGAL::Lazy_exact_nt<class CGAL::Gmpq>,struct CGAL::To_interval<class CGAL::Gmpq> > >::get(void)const " (?get#?$thread_specific_ptr#V?$Lazy#V?$Interval_nt#$0A##CGAL##VGmpq#2#V?$Lazy_exact_nt#VGmpq#CGAL###2#U?$To_interval#VGmpq#CGAL###2##CGAL###boost##QBEPAV?$Lazy#V?$Interval_nt#$0A##CGAL##VGmpq#2#V?$Lazy_exact_nt#VGmpq#CGAL###2#U?$To_interval#VGmpq#CGAL###2##CGAL##XZ)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_add_ui referenced in function "public: class CGAL::Gmpz & __thiscall CGAL::Gmpz::operator+=(int)" (??YGmpz#CGAL##QAEAAV01#H#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_clear referenced in function "public: __thiscall CGAL::Gmpz_rep::~Gmpz_rep(void)" (??1Gmpz_rep#CGAL##QAE#XZ)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_init referenced in function "public: __thiscall CGAL::Gmpz::Gmpz(void)" (??0Gmpz#CGAL##QAE#XZ)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_init_set_si referenced in function "public: __thiscall CGAL::Gmpz::Gmpz(int)" (??0Gmpz#CGAL##QAE#H#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_mul_si referenced in function "public: class CGAL::Gmpz & __thiscall CGAL::Gmpz::operator*=(int)" (??XGmpz#CGAL##QAEAAV01#H#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_set referenced in function "public: __thiscall CGAL::Gmpq::Gmpq(class CGAL::Gmpz const &,class CGAL::Gmpz const &)" (??0Gmpq#CGAL##QAE#ABVGmpz#1#0#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpz_sub_ui referenced in function "public: class CGAL::Gmpz & __thiscall CGAL::Gmpz::operator+=(int)" (??YGmpz#CGAL##QAEAAV01#H#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_add referenced in function "class CGAL::Gmpq __cdecl CGAL::operator+(class CGAL::Gmpq const &,class CGAL::Gmpq const &)" (??HCGAL##YA?AVGmpq#0#ABV10#0#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_canonicalize referenced in function "public: __thiscall CGAL::Gmpq::Gmpq(class CGAL::Gmpz const &,class CGAL::Gmpz const &)" (??0Gmpq#CGAL##QAE#ABVGmpz#1#0#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_clear referenced in function "public: __thiscall CGAL::Gmpq_rep::~Gmpq_rep(void)" (??1Gmpq_rep#CGAL##QAE#XZ)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_cmp referenced in function "public: bool __thiscall CGAL::Gmpq::operator<(class CGAL::Gmpq const &)const " (??MGmpq#CGAL##QBE_NABV01##Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_equal referenced in function "public: bool __thiscall CGAL::Gmpq::operator==(class CGAL::Gmpq const &)const " (??8Gmpq#CGAL##QBE_NABV01##Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_init referenced in function "public: __thiscall CGAL::Gmpq_rep::Gmpq_rep(void)" (??0Gmpq_rep#CGAL##QAE#XZ)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_mul referenced in function "class CGAL::Gmpq __cdecl CGAL::operator*(class CGAL::Gmpq const &,class CGAL::Gmpq const &)" (??DCGAL##YA?AVGmpq#0#ABV10#0#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_set_si referenced in function "public: __thiscall CGAL::Gmpq::Gmpq(int)" (??0Gmpq#CGAL##QAE#H#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp____gmpq_sub referenced in function "class CGAL::Gmpq __cdecl CGAL::operator-(class CGAL::Gmpq const &,class CGAL::Gmpq const &)" (??GCGAL##YA?AVGmpq#0#ABV10#0#Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp__mpfr_init2 referenced in function "public: struct std::pair<double,double> __thiscall CGAL::Real_embeddable_traits<class CGAL::Gmpq>::To_interval::operator()(class CGAL::Gmpq const &)const " (??RTo_interval#?$Real_embeddable_traits#VGmpq#CGAL###CGAL##QBE?AU?$pair#NN#std##ABVGmpq#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp__mpfr_clear referenced in function "public: struct std::pair<double,double> __thiscall CGAL::Real_embeddable_traits<class CGAL::Gmpq>::To_interval::operator()(class CGAL::Gmpq const &)const " (??RTo_interval#?$Real_embeddable_traits#VGmpq#CGAL###CGAL##QBE?AU?$pair#NN#std##ABVGmpq#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp__mpfr_set_q referenced in function "public: struct std::pair<double,double> __thiscall CGAL::Real_embeddable_traits<class CGAL::Gmpq>::To_interval::operator()(class CGAL::Gmpq const &)const " (??RTo_interval#?$Real_embeddable_traits#VGmpq#CGAL###CGAL##QBE?AU?$pair#NN#std##ABVGmpq#2##Z)
1>Source.obj : error LNK2019: unresolved external symbol __imp__mpfr_get_d referenced in function "public: struct std::pair<double,double> __thiscall CGAL::Real_embeddable_traits<class CGAL::Gmpq>::To_interval::operator()(class CGAL::Gmpq const &)const " (??RTo_interval#?$Real_embeddable_traits#VGmpq#CGAL###CGAL##QBE?AU?$pair#NN#std##ABVGmpq#2##Z)
1>E:\os\cgal_test\Debug\cgal_test.exe : fatal error LNK1120: 24 unresolved externals
project configuration :
here
I appreciate any help , thanks
You need to provide the linker with the boost libraries. In the linker properties in visual studio, add the correct directory to "Additional Library Directories".
Unresolved external means that you have a declaration of some function or variable, but the linker cannot find the definition. This usually happens when using 3rd party libraries which provide you with the interface as header files, but not with the actual code which is compiled as library files.
I've been like a pair of days trying to get a C++ app, but i'm stuck in the library / dll process, I have problems with those two.
I downloaded the c++ release for protobuf 3.0.0, made the .lib and the .dll ( to test the two of them ), I used this in order to get the .sln
cmake -Dprotobuf_BUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX="../install" ../cmake
it gave me a solution which I opened with vs2015 and compiled for debug, then compiled me the files, then I generated the includes with the .bat provided.
So, when I go to VS2015 and try to compile with the .lib linked, it gives me this error
1>libprotobufd.lib(dynamic_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj
I am sure that I'm running the app in the lib building as debug and the game as debug too.
Also, I tried the .dll ( deleting the library and the references ), writing in the top of the main.cpp file "#define PROTOBUF_USE_DLLS" and I get a lot of linker errors like this
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::LogMessage(enum google::protobuf::LogLevel,char const *,int)" (??0LogMessage#internal#protobuf#google##QAE#W4LogLevel#23#PBDH#Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: __thiscall google::protobuf::internal::LogMessage::~LogMessage(void)" (??1LogMessage#internal#protobuf#google##QAE#XZ) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: class google::protobuf::internal::LogMessage & __thiscall google::protobuf::internal::LogMessage::operator<<(char const *)" (??6LogMessage#internal#protobuf#google##QAEAAV0123#PBD#Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::internal::LogFinisher::operator=(class google::protobuf::internal::LogMessage &)" (??4LogFinisher#internal#protobuf#google##QAEXAAVLogMessage#123##Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::Closure::~Closure(void)" (??1Closure#protobuf#google##UAE#XZ) referenced in function "public: virtual void * __thiscall google::protobuf::Closure::`scalar deleting destructor'(unsigned int)" (??_GClosure#protobuf#google##UAEPAXI#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall google::protobuf::internal::FunctionClosure0::~FunctionClosure0(void)" (??1FunctionClosure0#internal#protobuf#google##UAE#XZ) referenced in function "public: virtual void * __thiscall google::protobuf::internal::FunctionClosure0::`scalar deleting destructor'(unsigned int)" (??_GFunctionClosure0#internal#protobuf#google##UAEPAXI#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::VerifyVersion(int,int,char const *)" (?VerifyVersion#internal#protobuf#google##YAXHHPBD#Z) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" (?protobuf_AddDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::OnShutdown(void (__cdecl*)(void))" (?OnShutdown#internal#protobuf#google##YAXP6AXXZ#Z) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" (?protobuf_AddDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void * __thiscall google::protobuf::Arena::AllocateAligned(class type_info const *,unsigned int)" (?AllocateAligned#Arena#protobuf#google##QAEPAXPBVtype_info##I#Z) referenced in function "public: struct google::protobuf::internal::InternalMetadataWithArena::Container * __thiscall google::protobuf::Arena::CreateInternal<struct google::protobuf::internal::InternalMetadataWithArena::Container>(bool)" (??$CreateInternal#UContainer#InternalMetadataWithArena#internal#protobuf#google###Arena#protobuf#google##QAEPAUContainer#InternalMetadataWithArena#internal#12#_N#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: void __thiscall google::protobuf::Arena::AddListNode(void *,void (__cdecl*)(void *))" (?AddListNode#Arena#protobuf#google##QAEXPAXP6AX0#Z#Z) referenced in function "public: struct google::protobuf::internal::InternalMetadataWithArena::Container * __thiscall google::protobuf::Arena::CreateInternal<struct google::protobuf::internal::InternalMetadataWithArena::Container>(bool)" (??$CreateInternal#UContainer#InternalMetadataWithArena#internal#protobuf#google###Arena#protobuf#google##QAEPAUContainer#InternalMetadataWithArena#internal#12#_N#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::GoogleOnceInitImpl(int *,class google::protobuf::Closure *)" (?GoogleOnceInitImpl#protobuf#google##YAXPAHPAVClosure#12##Z) referenced in function "void __cdecl google::protobuf::GoogleOnceInit(int *,void (__cdecl*)(void))" (?GoogleOnceInit#protobuf#google##YAXPAHP6AXXZ#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "void __cdecl google::protobuf::internal::MergeFromFail(char const *,int)" (?MergeFromFail#internal#protobuf#google##YAXPBDH#Z) referenced in function "public: void __thiscall tryPhy::PhyData::MergeFrom(class tryPhy::PhyData const &)" (?MergeFrom#PhyData#tryPhy##QAEXABV12##Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: void __thiscall google::protobuf::UnknownFieldSet::ClearFallback(void)" (?ClearFallback#UnknownFieldSet#protobuf#google##AAEXXZ) referenced in function "public: void __thiscall google::protobuf::UnknownFieldSet::Clear(void)" (?Clear#UnknownFieldSet#protobuf#google##QAEXXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class google::protobuf::MessageLite * __thiscall google::protobuf::MessageLite::New(class google::protobuf::Arena *)const " (?New#MessageLite#protobuf#google##UBEPAV123#PAVArena#23##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::MessageLite::InitializationErrorString(void)const " (?InitializationErrorString#MessageLite#protobuf#google##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual unsigned char * __thiscall google::protobuf::MessageLite::InternalSerializeWithCachedSizesToArray(bool,unsigned char *)const " (?InternalSerializeWithCachedSizesToArray#MessageLite#protobuf#google##UBEPAE_NPAE#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static class google::protobuf::DescriptorPool const * __cdecl google::protobuf::DescriptorPool::generated_pool(void)" (?generated_pool#DescriptorPool#protobuf#google##SAPBV123#XZ) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: class google::protobuf::FileDescriptor const * __thiscall google::protobuf::DescriptorPool::FindFileByName(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?FindFileByName#DescriptorPool#protobuf#google##QBEPBVFileDescriptor#23#ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const *,int)" (?InternalAddGeneratedFile#DescriptorPool#protobuf#google##SAXPBXH#Z) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" (?protobuf_AddDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CopyFrom(class google::protobuf::Message const &)" (?CopyFrom#Message#protobuf#google##UAEXABV123##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::MergeFrom(class google::protobuf::Message const &)" (?MergeFrom#Message#protobuf#google##UAEXABV123##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::Message::InitializationErrorString(void)const " (?InitializationErrorString#Message#protobuf#google##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::DiscardUnknownFields(void)" (?DiscardUnknownFields#Message#protobuf#google##UAEXXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::SpaceUsed(void)const " (?SpaceUsed#Message#protobuf#google##UBEHXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall google::protobuf::Message::GetTypeName(void)const " (?GetTypeName#Message#protobuf#google##UBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::Clear(void)" (?Clear#Message#protobuf#google##UAEXXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::IsInitialized(void)const " (?IsInitialized#Message#protobuf#google##UBE_NXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::CheckTypeAndMergeFrom(class google::protobuf::MessageLite const &)" (?CheckTypeAndMergeFrom#Message#protobuf#google##UAEXABVMessageLite#23##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall google::protobuf::Message::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream#Message#protobuf#google##UAE_NPAVCodedInputStream#io#23##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall google::protobuf::Message::ByteSize(void)const " (?ByteSize#Message#protobuf#google##UBEHXZ)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall google::protobuf::Message::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes#Message#protobuf#google##UBEXPAVCodedOutputStream#io#23##Z)
1>trycpp.pb.obj : error LNK2001: unresolved external symbol "private: virtual void __thiscall google::protobuf::Message::SetCachedSize(int)const " (?SetCachedSize#Message#protobuf#google##EBEXH#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::MessageFactory::InternalRegisterGeneratedFile(char const *,void (__cdecl*)(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &))" (?InternalRegisterGeneratedFile#MessageFactory#protobuf#google##SAXPBDP6AXABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z#Z) referenced in function "void __cdecl tryPhy::protobuf_AddDesc_trycpp_2eproto(void)" (?protobuf_AddDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(class google::protobuf::Descriptor const *,class google::protobuf::Message const *)" (?InternalRegisterGeneratedMessage#MessageFactory#protobuf#google##SAXPBVDescriptor#23#PBVMessage#23##Z) referenced in function "void __cdecl tryPhy::`anonymous namespace'::protobuf_RegisterTypes(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?protobuf_RegisterTypes#?A0x859c682f#tryPhy##YAXABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std###Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: bool __thiscall google::protobuf::io::CodedInputStream::ReadLittleEndian64Fallback(unsigned __int64 *)" (?ReadLittleEndian64Fallback#CodedInputStream#io#protobuf#google##AAE_NPA_K#Z) referenced in function "public: bool __thiscall google::protobuf::io::CodedInputStream::ReadLittleEndian64(unsigned __int64 *)" (?ReadLittleEndian64#CodedInputStream#io#protobuf#google##QAE_NPA_K#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "private: unsigned int __thiscall google::protobuf::io::CodedInputStream::ReadTagFallback(unsigned int)" (?ReadTagFallback#CodedInputStream#io#protobuf#google##AAEII#Z) referenced in function "public: struct std::pair<unsigned int,bool> __thiscall google::protobuf::io::CodedInputStream::ReadTagWithCutoff(unsigned int)" (?ReadTagWithCutoff#CodedInputStream#io#protobuf#google##QAE?AU?$pair#I_N#std##I#Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl google::protobuf::internal::WireFormatLite::SkipField(class google::protobuf::io::CodedInputStream *,unsigned int)" (?SkipField#WireFormatLite#internal#protobuf#google##SA_NPAVCodedInputStream#io#34#I#Z) referenced in function "public: virtual bool __thiscall tryPhy::PhyData::MergePartialFromCodedStream(class google::protobuf::io::CodedInputStream *)" (?MergePartialFromCodedStream#PhyData#tryPhy##UAE_NPAVCodedInputStream#io#protobuf#google###Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::WireFormatLite::WriteDouble(int,double,class google::protobuf::io::CodedOutputStream *)" (?WriteDouble#WireFormatLite#internal#protobuf#google##SAXHNPAVCodedOutputStream#io#34##Z) referenced in function "public: virtual void __thiscall tryPhy::PhyData::SerializeWithCachedSizes(class google::protobuf::io::CodedOutputStream *)const " (?SerializeWithCachedSizes#PhyData#tryPhy##UBEXPAVCodedOutputStream#io#protobuf#google###Z)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static class google::protobuf::internal::GeneratedMessageReflection * __cdecl google::protobuf::internal::GeneratedMessageReflection::NewGeneratedMessageReflection(class google::protobuf::Descriptor const *,class google::protobuf::Message const *,int const * const,int,int,int,int,int,int)" (?NewGeneratedMessageReflection#GeneratedMessageReflection#internal#protobuf#google##SAPAV1234#PBVDescriptor#34#PBVMessage#34#QBHHHHHHH#Z) referenced in function "void __cdecl tryPhy::protobuf_AssignDesc_trycpp_2eproto(void)" (?protobuf_AssignDesc_trycpp_2eproto#tryPhy##YAXXZ)
1>trycpp.pb.obj : error LNK2019: unresolved external symbol "public: static void __cdecl google::protobuf::internal::ReflectionOps::Merge(class google::protobuf::Message const &,class google::protobuf::Message *)" (?Merge#ReflectionOps#internal#protobuf#google##SAXABVMessage#34#PAV534##Z) referenced in function "public: virtual void __thiscall tryPhy::PhyData::MergeFrom(class google::protobuf::Message const &)" (?MergeFrom#PhyData#tryPhy##UAEXABVMessage#protobuf#google###Z)
1>bin\windows\multiplayer.exe : fatal error LNK1120: 40 unresolved externals
I'm a bit lost and stuck, so if anyone can help me to redirect where I have to search for, I'll be grateful.
Thank you for your time
As I can't comment, will post this as an answer.
If I understood the structure of your projects correctly, this thing:
`1>libprotobufd.lib(dynamic_message.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in main.obj`
tells you that the Runtime library setting for the library you're trying to link and your project does not match.
Check Project Properties -> C/C++ -> Code generation -> Runtime Library and make sure this setting is the same for both projects.
P.S. also having a problem linking with static library containing proto-files in vs2015 update 3 but seems that your case is different..
Maybe you should add the PROTOBUF_USE_DLLS define in the Visual Studio project properties under C/C++ -> Preprocessor -> Preprocessor definitions? I'm guessing you might need that define when compiling protobuf the protobuf output cpp files too.
I am trying to build a C++ application which connects to Perforce Server but build fails because it cannot find the p4api libraries.
I am new to C++, Visual Studio and p4api so I probably did something wrong.
I am using Windows 8 and Visual Studio 2013 Professional.
Details:
I downloaded p4api.zip from ftp://ftp.perforce.com/perforce/r15.2/bin.mingw64x64/
Notice that the libraries found in p4api.zip are of type .a where as in the Chapter 2 of user guide says that for Windows it should be .lib
Visual Studio Configuration:
From Visual Studio, Project properties -> Configuration Properties:
Linker -> General -> Additional Libraries Directories => I specified the directory containing the p4api .a files eg C:\Users\myuser\Documents\Visual Studio 2013\Projects\ProjectName\ProjectName\lib\p4api
Linker -> Input -> Additional Dependencies => I specified the name of each .a file in the order described on user guide. I also added extra libs as described in this blog eg libclient.a;librpc.a;libsupp.a;libp4sslstub.a;wsock32.lib;libcmt.lib;oldnames.lib;kernel32.lib;ws2_32.lib;advapi32.lib
Linker -> Command Line -> Additional Options => As in user guide eg /DOS_NT /MT /DCASE_INSENSITIVE
C/C++ -> General -> Additional Include Directories => I specified the location of perforce header files eg C:\Users\myuser\Documents\Visual Studio 2013\Projects\ ProjectName\ProjectName\include\p4
Code
Main.h
#pragma once
#include <iostream>
#include <clientapi.h>
class Main : public ClientUser
{
public:
Main();
~Main();
};
Main.cpp
#include "Main.h"
Main::Main()
{
}
Main::~Main()
{
}
int main() {
std::cout << "Hello World\n";
ClientApi client;
Error e;
client.Init(&e);
Main ui;
client.Run("info", &ui);
client.Final(&e);
}
Build Errors:
1>------ Build started: Project: PEConnect, Configuration: Debug Win32 ------
1>cl : Command line warning D9025: overriding '/MDd' with '/MT'
1> Main.cpp
1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall Error::~Error(void)" (??1Error##QAE#XZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall ClientUser::~ClientUser(void)" (??1ClientUser##UAE#XZ) referenced in function "public: virtual __thiscall Main::~Main(void)" (??1Main##UAE#XZ)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::InputData(class StrBuf *,class Error *)" (?InputData#ClientUser##UAEXPAVStrBuf##PAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::HandleError(class Error *)" (?HandleError#ClientUser##UAEXPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Message(class Error *)" (?Message#ClientUser##UAEXPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::OutputError(char const *)" (?OutputError#ClientUser##UAEXPBD#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::OutputInfo(char,char const *)" (?OutputInfo#ClientUser##UAEXDPBD#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::OutputBinary(char const *,int)" (?OutputBinary#ClientUser##UAEXPBDH#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::OutputText(char const *,int)" (?OutputText#ClientUser##UAEXPBDH#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::OutputStat(class StrDict *)" (?OutputStat#ClientUser##UAEXPAVStrDict###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Prompt(class StrPtr const &,class StrBuf &,int,class Error *)" (?Prompt#ClientUser##UAEXABVStrPtr##AAVStrBuf##HPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Prompt(class StrPtr const &,class StrBuf &,int,int,class Error *)" (?Prompt#ClientUser##UAEXABVStrPtr##AAVStrBuf##HHPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::ErrorPause(char *,class Error *)" (?ErrorPause#ClientUser##UAEXPADPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Edit(class FileSys *,class Error *)" (?Edit#ClientUser##UAEXPAVFileSys##PAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Diff(class FileSys *,class FileSys *,int,char *,class Error *)" (?Diff#ClientUser##UAEXPAVFileSys##0HPADPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Diff(class FileSys *,class FileSys *,class FileSys *,int,char *,class Error *)" (?Diff#ClientUser##UAEXPAVFileSys##00HPADPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Merge(class FileSys *,class FileSys *,class FileSys *,class FileSys *,class Error *)" (?Merge#ClientUser##UAEXPAVFileSys##000PAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ClientUser::Resolve(class ClientMerge *,class Error *)" (?Resolve#ClientUser##UAEHPAVClientMerge##PAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ClientUser::Resolve(class ClientResolveA *,int,class Error *)" (?Resolve#ClientUser##UAEHPAVClientResolveA##HPAVError###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::Help(char const * const *)" (?Help#ClientUser##UAEXPBQBD#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual class FileSys * __thiscall ClientUser::File(enum FileSysType)" (?File#ClientUser##UAEPAVFileSys##W4FileSysType###Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual class ClientProgress * __thiscall ClientUser::CreateProgress(int)" (?CreateProgress#ClientUser##UAEPAVClientProgress##H#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual int __thiscall ClientUser::ProgressIndicator(void)" (?ProgressIndicator#ClientUser##UAEHXZ)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::SetOutputCharset(int)" (?SetOutputCharset#ClientUser##UAEXH#Z)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::DisableTmpCleanup(void)" (?DisableTmpCleanup#ClientUser##UAEXXZ)
1>Main.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall ClientUser::SetQuiet(void)" (?SetQuiet#ClientUser##UAEXXZ)
1>Main.obj : error LNK2019: unresolved external symbol "public: __thiscall ClientApi::ClientApi(void)" (??0ClientApi##QAE#XZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall ClientApi::~ClientApi(void)" (??1ClientApi##UAE#XZ) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall ClientApi::Init(class Error *)" (?Init#ClientApi##QAEXPAVError###Z) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: void __thiscall ClientApi::Run(char const *,class ClientUser *)" (?Run#ClientApi##QAEXPBDPAVClientUser###Z) referenced in function _main
1>Main.obj : error LNK2019: unresolved external symbol "public: int __thiscall ClientApi::Final(class Error *)" (?Final#ClientApi##QAEHPAVError###Z) referenced in function _main
1>Main.obj : error LNK2001: unresolved external symbol "private: static char * StrBuf::nullStrBuf" (?nullStrBuf#StrBuf##0PADA)
1>c:\users\myuser\documents\visual studio 2013\Projects\ProjectName\Debug\PEConnect.exe : fatal error LNK1120: 32 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Additional concerns:
1) Did I download the correct p4api? I cannot find a folder specifically for Windows. The only folder which looks more relevant to Windows is bin.mingw
2) Why the library files are of type .a not .lib?
3) Did I set the dependencies correctly on Visual Studio? If yes, why build fails?
Please let me know if you need more details.
Thanks in advance.
I'm trying to link to a static build of Qwt. to create the static build, I modified qwtconfig.pri to contain
#QWT_CONFIG += QwtDll
and I removed all the #define QWT_DLL references in the code.
However, when I link to the library, I get a bunch of undefined references complaining about QSvgRenderer:
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl QSvgRenderer::QSvgRenderer(class QObject *)" (__imp_??0QSvgRenderer##QEAA#PEAVQObject###Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument#QwtSymbol##QEAAXAEBVQByteArray###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl QSvgRenderer::~QSvgRenderer(void)" (__imp_??1QSvgRenderer##UEAA#XZ) referenced in function "public: virtual void * __cdecl QSvgRenderer::`scalar deleting destructor'(unsigned int)" (??_GQSvgRenderer##UEAAPEAXI#Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::isValid(void)const " (__imp_?isValid#QSvgRenderer##QEBA_NXZ) referenced in function "void __cdecl qwtDrawSvgSymbols(class QPainter *,class QPointF const *,int,class QSvgRenderer *,class QwtSymbol const &)" (?qwtDrawSvgSymbols##YAXPEAVQPainter##PEBVQPointF##HPEAVQSvgRenderer##AEBVQwtSymbol###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QRectF __cdecl QSvgRenderer::viewBoxF(void)const " (__imp_?viewBoxF#QSvgRenderer##QEBA?AVQRectF##XZ) referenced in function "public: virtual class QRect __cdecl QwtSymbol::boundingRect(void)const " (?boundingRect#QwtSymbol##UEBA?AVQRect##XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: bool __cdecl QSvgRenderer::load(class QByteArray const &)" (__imp_?load#QSvgRenderer##QEAA_NAEBVQByteArray###Z) referenced in function "public: void __cdecl QwtSymbol::setSvgDocument(class QByteArray const &)" (?setSvgDocument#QwtSymbol##QEAAXAEBVQByteArray###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl QSvgRenderer::render(class QPainter *,class QRectF const &)" (__imp_?render#QSvgRenderer##QEAAXPEAVQPainter##AEBVQRectF###Z) referenced in function "public: void __cdecl QwtSymbol::drawSymbol(class QPainter *,class QRectF const &)const " (?drawSymbol#QwtSymbol##QEBAXPEAVQPainter##AEBVQRectF###Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl QSvgRenderer::metaObject(void)const " (?metaObject#QSvgRenderer##UEBAPEBUQMetaObject##XZ)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual int __cdecl QSvgRenderer::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall#QSvgRenderer##UEAAHW4Call#QMetaObject##HPEAPEAX#Z)
15>qwt.lib(qwt_symbol.obj) : error LNK2001: unresolved external symbol "public: virtual void * __cdecl QSvgRenderer::qt_metacast(char const *)" (?qt_metacast#QSvgRenderer##UEAAPEAXPEBD#Z)
15>C:\workspace\fixQwt\executables\linkerGUI\bin\Release\linkerGUI.exe : fatal error LNK1120: 9 unresolved externals
Is there something else in the project configuration I need to do so it can link properly to QSvgRenderer?
Guess your version of Qt is without SVG support - or you forget to add it to your project dependency. If you are not interested in SVG stuff at all you could also disable it in qwtconfig.pri as well:
See: "QWT_CONFIG += QwtSvg"