I've been following a development tutorial for foobar2000 components, but keep getting build errors with only minimal code. My VS solution includes these projects from the foobar2000 SDK: foobar2000_component_client, foobar200_SDK, and pfc.
foo_playlists_tag.cpp:
#include "U:\SDK\Foobar2000-music-player\foobar2000\SDK\foobar2000.h"
DECLARE_COMPONENT_VERSION("Playlists tagger","0.0.1","About text here");
VALIDATE_COMPONENT_FILENAME("foo_playlists_tag.dll");
Build ouput:
1>------ Build started: Project: foo_playlists_tag, Configuration: Debug x64 ------
1> foo_playlists_tag.cpp
1>u:\sdk\foobar2000-music-player\foobar2000\shared\fb2kdebug.h(80): warning C4838: conversion from 'int' to 'const ULONG_PTR' requires a narrowing conversion
1>foo_playlists_tag.obj : error LNK2019: unresolved external symbol "void __cdecl pfc::myassert_win32(wchar_t const *,wchar_t const *,unsigned int)" (?myassert_win32#pfc##YAXPEB_W0I#Z) referenced in function __catch$??$service_add_ref_safe#Vcomponent_installation_validator####YAXPEAVcomponent_installation_validator###Z$0
1>foo_playlists_tag.obj : error LNK2019: unresolved external symbol "char const * __cdecl core_api::get_my_file_name(void)" (?get_my_file_name#core_api##YAPEBDXZ) referenced in function "public: virtual void __cdecl `anonymous namespace'::componentversion_myimpl::get_file_name(class pfc::string_base &)" (?get_file_name#componentversion_myimpl#?A0xa2c48e39##UEAAXAEAVstring_base#pfc###Z)
1>foo_playlists_tag.obj : error LNK2019: unresolved external symbol "bool __cdecl core_api::are_services_available(void)" (?are_services_available#core_api##YA_NXZ) referenced in function "protected: __cdecl service_factory_base::service_factory_base(struct _GUID const &,class service_factory_base * &)" (??0service_factory_base##IEAA#AEBU_GUID##AEAPEAV0##Z)
1>foo_playlists_tag.obj : error LNK2019: unresolved external symbol "public: static bool __cdecl component_installation_validator::test_my_name(char const *)" (?test_my_name#component_installation_validator##SA_NPEBD#Z) referenced in function "public: virtual bool __cdecl component_installation_validator_filename::is_installed_correctly(void)" (?is_installed_correctly#component_installation_validator_filename##UEAA_NXZ)
1>foo_playlists_tag.obj : error LNK2001: unresolved external symbol "public: static class service_factory_base * service_factory_base::__internal__list" (?__internal__list#service_factory_base##2PEAV1#EA)
1>foo_playlists_tag.obj : error LNK2001: unresolved external symbol "public: static struct _GUID const componentversion::class_guid" (?class_guid#componentversion##2U_GUID##B)
1>foo_playlists_tag.obj : error LNK2001: unresolved external symbol "public: static struct _GUID const component_installation_validator::class_guid" (?class_guid#component_installation_validator##2U_GUID##B)
1>U:\Repositories\foo_playlists_tag\x64\Debug\foo_playlists_tag.dll : fatal error LNK1120: 7 unresolved externals
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
Where are these errors coming from? and how can I resovle them?
Any assistance is greatly appreciated.
Found my answer on hydrogenaud.io by user kode54:
In Visual Studio 2010, you must add all dependencies directly to the project you are trying to link, as references. You may find the references list in the Properties dialog for the project, under Common Properties, Frameworks and References. The old style Dependencies dialog doesn't seem to function for that purpose past Visual Studio 2008.
Thank you for your assistance; helped me find that lib file.
Related
I am running this repo: https://github.com/tomhsu1990/Iterative-Closest-Point-ICP. (demonstration video: https://www.youtube.com/watch?v=m64E47uvPYc).
I built it well in Ubuntu but get a error when build it in Windows. I google in a few days but I can not fix it, it's quite different with some LNK2019 errors that I found on the internet.
Rebuild started...
1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
2>------ Rebuild All started: Project: ICP, Configuration: Debug x64 ------
2>Building Custom Rule C:/Users/tady/Downloads/Compressed/Iterative-Closest-Point-ICP-master/CMakeLists.txt
2>ICP.cpp
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(42,21): warning C4018: '<': signed/unsigned mismatch
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(43,22): warning C4018: '<': signed/unsigned mismatch
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(51,18): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'unsigned __int64'
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(51,18): message : consider using '%zd' in the format string
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(64,50): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\ICP.cpp(74,53): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
2>ICPHelper.cpp
2>ANNHelper.cpp
2>RandomGenerator.cpp
2>Generating Code...
2>ICP.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) double * __cdecl annAllocPt(int,double)" (__imp_?annAllocPt##YAPEANHN#Z) referenced in function "public: __cdecl ANNHelper::ANNHelper(int,int,double,int)" (??0ANNHelper##QEAA#HHNH#Z)
2>ICP.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) double * * __cdecl annAllocPts(int,int)" (__imp_?annAllocPts##YAPEAPEANHH#Z) referenced in function "public: __cdecl ANNHelper::ANNHelper(int,int,double,int)" (??0ANNHelper##QEAA#HHNH#Z)
2>ANNHelper.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl ANNkd_tree::ANNkd_tree(double * *,int,int,int,enum ANNsplitRule)" (__imp_??0ANNkd_tree##QEAA#PEAPEANHHHW4ANNsplitRule###Z) referenced in function "public: void __cdecl ANNHelper::initializeKdTree(void)" (?initializeKdTree#ANNHelper##QEAAXXZ)
2>ANNHelper.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: virtual __cdecl ANNkd_tree::~ANNkd_tree(void)" (__imp_??1ANNkd_tree##UEAA#XZ) referenced in function "public: virtual void * __cdecl ANNkd_tree::`scalar deleting destructor'(unsigned int)" (??_GANNkd_tree##UEAAPEAXI#Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANNkd_tree::Dump(enum ANNbool,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?Dump#ANNkd_tree##UEAAXW4ANNbool##AEAV?$basic_ostream#DU?$char_traits#D#std###std###Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANNkd_tree::Print(enum ANNbool,class std::basic_ostream<char,struct std::char_traits<char> > &)" (?Print#ANNkd_tree##UEAAXW4ANNbool##AEAV?$basic_ostream#DU?$char_traits#D#std###std###Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl ANNkd_tree::annkFRSearch(double *,double,int,int *,double *,double)" (?annkFRSearch#ANNkd_tree##UEAAHPEANNHPEAH0N#Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANNkd_tree::annkSearch(double *,int,int *,double *,double)" (?annkSearch#ANNkd_tree##UEAAXPEANHPEAH0N#Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl ANNkd_tree::getStats(class ANNkdStats &)" (?getStats#ANNkd_tree##UEAAXAEAVANNkdStats###Z)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl ANNkd_tree::nPoints(void)" (?nPoints#ANNkd_tree##UEAAHXZ)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl ANNkd_tree::theDim(void)" (?theDim#ANNkd_tree##UEAAHXZ)
2>ANNHelper.obj : error LNK2001: unresolved external symbol "public: virtual double * * __cdecl ANNkd_tree::thePoints(void)" (?thePoints#ANNkd_tree##UEAAPEAPEANXZ)
2>..\ann_1.1.2\lib\ANN.lib : warning LNK4272: library machine type 'x86' conflicts with target machine type 'x64'
2>C:\Users\tady\Downloads\Compressed\Iterative-Closest-Point-ICP-master\build\Debug\ICP.exe : fatal error LNK1120: 12 unresolved externals
2>Done building project "ICP.vcxproj" -- FAILED.
3>------ Skipped Rebuild All: Project: ALL_BUILD, Configuration: Debug x64 ------
3>Project not selected to build for this solution configuration
========== Rebuild All: 1 succeeded, 1 failed, 1 skipped ==========
This is the video I built this repo and got a this error: https://www.youtube.com/watch?v=HhQGD8Hic9U.
I would really appreciate, any help or at least some advice, where I can learn more about this problem.
I'm trying to build this simple ZeroMQ server in C++ on Visual Studio 2013.
#include "stdafx.h"
#include "zmq.hpp"
#include <string>
#include <iostream>
#include <windows.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
// Prepare context and socket
zmq::context_t ctx(1);
zmq::socket_t sckt(ctx, ZMQ_REP);
sckt.bind("tcp://*:5555");
while (true) {
zmq::message_t request;
// Wait for next request from client
sckt.recv(&request);
std::cout << "Received Hello" << endl;
Sleep(1);
// Send reply back to client
zmq::message_t reply(5);
memcpy((void*)reply.data(), "World", 5);
sckt.send(reply);
}
return EXIT_SUCCESS;
}
However, I'm getting error LNK2019 when I try to build the VS project. Below is the compiler output:
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_errno referenced in function "public: __thiscall zmq::error_t::error_t(void)" (??0error_t#zmq##QAE#XZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_strerror referenced in function "public: virtual char const * __thiscall zmq::error_t::what(void)const " (?what#error_t#zmq##UBEPBDXZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_ctx_new referenced in function "public: __thiscall zmq::context_t::context_t(int,int)" (??0context_t#zmq##QAE#HH#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_ctx_set referenced in function "public: __thiscall zmq::context_t::context_t(int,int)" (??0context_t#zmq##QAE#HH#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_ctx_destroy referenced in function "public: void __thiscall zmq::context_t::close(void)" (?close#context_t#zmq##QAEXXZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_init referenced in function "public: __thiscall zmq::message_t::message_t(void)" (??0message_t#zmq##QAE#XZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_init_size referenced in function "public: __thiscall zmq::message_t::message_t(unsigned int)" (??0message_t#zmq##QAE#I#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_send referenced in function "public: bool __thiscall zmq::socket_t::send(class zmq::message_t &,int)" (?send#socket_t#zmq##QAE_NAAVmessage_t#2#H#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_recv referenced in function "public: bool __thiscall zmq::socket_t::recv(class zmq::message_t *,int)" (?recv#socket_t#zmq##QAE_NPAVmessage_t#2#H#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_close referenced in function "public: __thiscall zmq::message_t::~message_t(void)" (??1message_t#zmq##QAE#XZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_msg_data referenced in function "public: void * __thiscall zmq::message_t::data(void)" (?data#message_t#zmq##QAEPAXXZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_socket referenced in function "public: __thiscall zmq::socket_t::socket_t(class zmq::context_t &,int)" (??0socket_t#zmq##QAE#AAVcontext_t#1#H#Z)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_close referenced in function "public: void __thiscall zmq::socket_t::close(void)" (?close#socket_t#zmq##QAEXXZ)
1>ZeroMQServer.obj : error LNK2019: unresolved external symbol __imp__zmq_bind referenced in function "public: void __thiscall zmq::socket_t::bind(char const *)" (?bind#socket_t#zmq##QAEXPBD#Z)
1>D:\[ Source Code ]\C++\ZeroMQServer\Debug\ZeroMQServer.exe : fatal error LNK1120: 14 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I have installed the ZeroMQ binary v4.0.4 and updated the VS project properties to point to ZeroMQ's include and lib paths. Specifically, this is what I have updated in the project properties (I suspect some of these settings may be redundant):
Configuration Properties > VC++ Directories > Include Directories: Added '$(ZEROMQ_HOME)\include'
Configuration Properties > VC++ Directories > Library Directories: Added '$(ZEROMQ_HOME)\lib'
Configuration Properties > C/C++ > General > Additional Include Directories: Added '$(ZEROMQ_HOME)\include'
Configuration Properties > Linker > Input > Additional Dependencies: Added 'libzmq-v120-mt-4_0_4.lib;libzmq-v120-mt-gd-4_0_4.lib'
I'm on Win 7, 64-bit Edition.
Please help me resolve this.
According to the library names on zeromq.org, you are trying to link the same library twice: first with the release version, and then with the debug versions.
Remove libzmq-v120-mt-gd-4_0_4.lib from your Release configuration, and remove libzmq-v120-mt-4_0_4.lib from your Debug configuration.
[edit]
Your application probably is 32bit, and the library you are trying to link with is 64bit. (You can use dumpbin to determine what architecture a .lib file is for, see this answer for an example. Please use the 32bit library, or change your application to 64bit.
I had to define ZMQ_STATIC since I wanted to link zmq statically.
By default all these functions defined as
elif defined DLL_EXPORT
define ZMQ_EXPORT __declspec(dllexport)
I had the same errors. But for me they were produced by a wrong set calling convention.
(Just wanted to mention it here because it cost me more than a hour to track it.)
I'm trying to build a Teamcenter ITK project generated from an SOA I created in BMIDE. The method I'm calling in my SOA service should retrieve all the saved queries from Teamcenter. I added all the needed libraries and dependencies I think might be needed. But I still get errors I can't understand and don't know how to solve.
My generated .hxx file is as following:
#ifndef TEAMCENTER_SERVICES_QUERYBUILDERLIB_2014_06_QUERYBUILDERSVC_IMPL_HXX
#define TEAMCENTER_SERVICES_QUERYBUILDERLIB_2014_06_QUERYBUILDERSVC_IMPL_HXX
#include <querybuildersvc1406.hxx>
#include <QueryBuilderLib_exports.h>
namespace Q2
{
namespace Soa
{
namespace QueryBuilderLib
{
namespace _2014_06
{
class QueryBuilderSvcImpl;
}
}
}
}
class SOAQUERYBUILDERLIB_API Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvcImpl : public Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc
{
public:
virtual QueryBuilderSvcImpl::SavedQueriesResponse getSavedQueries ( );
};
#include <QueryBuilderLib_undef.h>
#endif
This is my generated .cxx file with the implementation I added to the method:
#include <unidefs.h>
#if defined(SUN)
#include <unistd.h>
#endif
#include "querybuildersvc1406impl.hxx"
using namespace Q2::Soa::QueryBuilderLib::_2014_06;
using namespace Teamcenter::Soa::Server;
#include <qry/qry.h>
QueryBuilderSvcImpl::SavedQueriesResponse QueryBuilderSvcImpl::getSavedQueries() {
ServiceData svcData;
SavedQueriesResponse response;
std::vector<QueryObject> savedQueries;
int query_count;
tag_t* query_tags;
char* queryName;
char* queryDescription;
int i;
QRY_extent(&query_count, &query_tags);
for (i = 0; i < query_count; i++) {
QRY_ask_name2(query_tags[i], &queryName);
QRY_ask_description2(query_tags[i], &queryDescription);
// create a smart pointer of Item Type from object tag
BusinessObjectRef<Teamcenter::ImanQuery> query(query_tags[i]);
QueryObject tmpQueryObject;
// query
tmpQueryObject.query = query;
// Name
std::string strName(queryName);
tmpQueryObject.queryName = strName;
// Description
std::string strDescription(queryDescription);
tmpQueryObject.queryDescription = strDescription;
savedQueries.push_back(tmpQueryObject);
}
response.services = svcData;
response.queries = savedQueries;
return response;
}
When building the solution, I get the following errors in VS10:
1>------ Build started: Project: QueryBuilderProject, Configuration: Debug x64 ------
1>Build started 3/30/2015 9:27:21 AM.
1>InitializeBuildStatus:
1> Touching "x64\Debug\QueryBuilderProject.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>querybuildersvc1406impl.obj : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in itk_main.obj
1> Creating library E:\TC_INSTALL\Siemens\Teamcenter10\bmide\workspace\10000.1.0\QueryBuilderProj\src\server\Q2SoaQueryBuilderLib\x64\Debug\QueryBuilderProject.lib and object E:\TC_INSTALL\Siemens\Teamcenter10\bmide\workspace\10000.1.0\QueryBuilderProj\src\server\Q2SoaQueryBuilderLib\x64\Debug\QueryBuilderProject.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>itk_main.obj : error LNK2019: unresolved external symbol ITK_user_main referenced in function "int __cdecl ms_exception_handling_wrapper(int,char * *)" (?ms_exception_handling_wrapper##YAHHPEAPEAD#Z)
1>querybuildersvc1406impl.obj : error LNK2001: unresolved external symbol "public: virtual void __cdecl Teamcenter::Soa::Server::PartialErrors::addErrorStack(class BusinessObjectRef<class Teamcenter::BusinessObject>)" (?addErrorStack#PartialErrors#Server#Soa#Teamcenter##UEAAXV?$BusinessObjectRef#VBusinessObject#Teamcenter#####Z)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __cdecl Teamcenter::Schemas::Soa::_2006_03::Exceptions::ServiceException::ServiceException(class Teamcenter::Schemas::Soa::_2006_03::Exceptions::ServiceException const &)" (__imp_??0ServiceException#Exceptions#_2006_03#Soa#Schemas#Teamcenter##QEAA#AEBV012345##Z) referenced in function "public: __cdecl Teamcenter::Soa::Server::ServiceException::ServiceException(class Teamcenter::Soa::Server::ServiceException const &)" (??0ServiceException#Server#Soa#Teamcenter##QEAA#AEBV0123##Z)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class Teamcenter::Schemas::Soa::_2006_03::Exceptions::ServiceException & __cdecl Teamcenter::Schemas::Soa::_2006_03::Exceptions::ServiceException::operator=(class Teamcenter::Schemas::Soa::_2006_03::Exceptions::ServiceException const &)" (__imp_??4ServiceException#Exceptions#_2006_03#Soa#Schemas#Teamcenter##QEAAAEAV012345#AEBV012345##Z) referenced in function "public: class Teamcenter::Soa::Server::ServiceException & __cdecl Teamcenter::Soa::Server::ServiceException::operator=(class Teamcenter::Soa::Server::ServiceException const &)" (??4ServiceException#Server#Soa#Teamcenter##QEAAAEAV0123#AEBV0123##Z)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "public: virtual __cdecl Teamcenter::Soa::Server::ServiceData::~ServiceData(void)" (??1ServiceData#Server#Soa#Teamcenter##UEAA#XZ) referenced in function "public: virtual struct Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc::SavedQueriesResponse __cdecl Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvcImpl::getSavedQueries(void)" (?getSavedQueries#QueryBuilderSvcImpl#_2014_06#QueryBuilderLib#Soa#Q2##UEAA?AUSavedQueriesResponse#QueryBuilderSvc#2345#XZ)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "public: class Teamcenter::Soa::Server::ServiceData & __cdecl Teamcenter::Soa::Server::ServiceData::operator=(class Teamcenter::Soa::Server::ServiceData const &)" (??4ServiceData#Server#Soa#Teamcenter##QEAAAEAV0123#AEBV0123##Z) referenced in function "public: virtual struct Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc::SavedQueriesResponse __cdecl Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvcImpl::getSavedQueries(void)" (?getSavedQueries#QueryBuilderSvcImpl#_2014_06#QueryBuilderLib#Soa#Q2##UEAA?AUSavedQueriesResponse#QueryBuilderSvc#2345#XZ)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "public: __cdecl Teamcenter::Soa::Server::ServiceData::ServiceData(void)" (??0ServiceData#Server#Soa#Teamcenter##QEAA#XZ) referenced in function "public: virtual struct Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc::SavedQueriesResponse __cdecl Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvcImpl::getSavedQueries(void)" (?getSavedQueries#QueryBuilderSvcImpl#_2014_06#QueryBuilderLib#Soa#Q2##UEAA?AUSavedQueriesResponse#QueryBuilderSvc#2345#XZ)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "public: __cdecl Teamcenter::Soa::Server::ServiceData::ServiceData(class Teamcenter::Soa::Server::ServiceData const &)" (??0ServiceData#Server#Soa#Teamcenter##QEAA#AEBV0123##Z) referenced in function "public: __cdecl Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc::SavedQueriesResponse::SavedQueriesResponse(struct Q2::Soa::QueryBuilderLib::_2014_06::QueryBuilderSvc::SavedQueriesResponse const &)" (??0SavedQueriesResponse#QueryBuilderSvc#_2014_06#QueryBuilderLib#Soa#Q2##QEAA#AEBU012345##Z)
1>querybuildersvc1406impl.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Teamcenter::Soa::Common::Xml::BaseObject::unref(void)" (__imp_?unref#BaseObject#Xml#Common#Soa#Teamcenter##QEAAXXZ) referenced in function "public: __cdecl Teamcenter::Soa::Common::AutoPtr<class Teamcenter::Schemas::Soa::_2006_03::Base::PartialErrors>::~AutoPtr<class Teamcenter::Schemas::Soa::_2006_03::Base::PartialErrors>(void)" (??1?$AutoPtr#VPartialErrors#Base#_2006_03#Soa#Schemas#Teamcenter###Common#Soa#Teamcenter##QEAA#XZ)
1>E:\TC_INSTALL\Siemens\Teamcenter10\bmide\workspace\10000.1.0\QueryBuilderProj\src\server\Q2SoaQueryBuilderLib\x64\Debug\QueryBuilderProject.exe : fatal error LNK1120: 9 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.23
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
This issue was finally solved when I did all the job from BMIDE on again. I guess that it was because I forgot to add -dll libqry.lib in LINK_FLAGS entry under # Platform specific options and commands in the BMIDE project's Makefile.
— riroo
This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I'm a beginner C++ programmer. I'm trying Google Test in Visual Studio 2012 and have problem starting a demo source code I got from internet.
int CompareChar(char* ch1, char* ch2)
{
if (ch1 == NULL || ch2 == NULL)
return 88;
return strcmp(ch1, ch2);
}
TEST(CompareCharTest, InputChar) {
// Expect equal
EXPECT_EQ(0, CompareChar("hello", "hello"));
// Expect not equal
EXPECT_NE(0, CompareChar("hello", "world"));
}
TEST(SampleClassTest, InputNumber) {
SampleClass sample(10);
EXPECT_EQ(1, sample.CompareValue(10)); // Expect equal
}
int _tmain(int argc, _TCHAR* argv[])
{
::testing::InitGoogleTest(&argc, argv);
int i = RUN_ALL_TESTS();
getchar();
return i;
}
So, when I try to build the code, it generates dozens of linking errors which I couldn't sort out. I tried to include .lib files in the property of the project but couldn't solve it.
The error:
>1>------ Build started: Project: GTestSample, Configuration: Release Win32 ------
>1> stdafx.cpp
1> GTestSample.cpp
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > __thiscall testing::Message::GetString(void)const " (?GetString#Message#testing##QBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::Message::Message(void)" (??0Message#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: static class testing::UnitTest * __cdecl testing::UnitTest::GetInstance(void)" (?GetInstance#UnitTest#testing##SAPAV12#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: int __thiscall testing::UnitTest::Run(void)" (?Run#UnitTest#testing##QAEHXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: __thiscall testing::Test::Test(void)" (??0Test#testing##IAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall testing::Test::~Test(void)" (??1Test#testing##UAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::TestInfo * __cdecl testing::internal::MakeAndRegisterTestInfo(char const *,char const *,char const *,char const *,void const *,void (__cdecl*)(void),void (__cdecl*)(void),class testing::internal::TestFactoryBase *)" (?MakeAndRegisterTestInfo#internal#testing##YAPAVTestInfo#2#PBD000PBXP6AXXZ2PAVTestFactoryBase#12##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void const * __cdecl testing::internal::GetTestTypeId(void)" (?GetTestTypeId#internal#testing##YAPBXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: void __thiscall testing::internal::AssertHelper::operator=(class testing::Message const &)const " (??4AssertHelper#internal#testing##QBEXABVMessage#2##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::AssertHelper(enum testing::TestPartResult::Type,char const *,int,char const *)" (??0AssertHelper#internal#testing##QAE#W4Type#TestPartResult#2#PBDH1#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::internal::AssertHelper::~AssertHelper(void)" (??1AssertHelper#internal#testing##QAE#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "void __cdecl testing::InitGoogleTest(int *,wchar_t * *)" (?InitGoogleTest#testing##YAXPAHPAPA_W#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "bool __cdecl testing::internal::IsTrue(bool)" (?IsTrue#internal#testing##YA_N_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionSuccess(void)" (?AssertionSuccess#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "public: __thiscall testing::AssertionResult::AssertionResult(class testing::AssertionResult const &)" (??0AssertionResult#testing##QAE#ABV01##Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::AssertionFailure(void)" (?AssertionFailure#testing##YA?AVAssertionResult#1#XZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "class testing::AssertionResult __cdecl testing::internal::EqFailure(char const *,char const *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,bool)" (?EqFailure#internal#testing##YA?AVAssertionResult#2#PBD0ABV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##1_N#Z)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::SetUp(void)" (?SetUp#Test#testing##MAEXXZ)
1>GTestSample.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall testing::Test::TearDown(void)" (?TearDown#Test#testing##MAEXXZ)
1>D:\VisualStudioProj\GTestSample\Release\GTestSample.exe : fatal error LNK1120: 19 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I had the same issue. Make sure that in your test project's properties, you go into Project->Linker->General settings and add the msvc/Release directory to Additional Directories. Furthermore, under Linker->Input, add gtest.lib into Additional Dependencies. Then you should be good to go!
I know this post is old, but it could still help anyone out. A quick Google search for "LNK2019 unresolved external symbol "bool __cdecl testing::internal::IsTrue ..." as stated above gives this stackoverflow and several sites with the same answers.
For those that tried Oleg Vaskevich solution or similar and failed, try this. If you are using Visual Studio, C/C++ -> General -> Additional Include Directories and make sure that the gtest is included. Secondly, (which will likely be your answer), copy the gtest-all.cc in the gtest/scr/ folder and paste in your project directory (wherever your .cpp/.h files are saved), then go back to Visual Studio and include it in your project. You will have to unhide files/folders to view it. 'Include to project'.
I know that copying and pasting this isn't ideal for every project, but the point is to at least get it working and making sure this is the true problem and not something else.
Because I never complied my version, I never had any lib files to begin with.
I am quite new to C++ so I downloaded a sample C++ program. The sample program seems to hit the following error when it is compiling :-
Error 22 error LNK2019: unresolved external symbol _acsEnumServerNames#12 referenced in function "protected: virtual int __thiscall COpenTsrv::OnInitDialog(void)" (?OnInitDialog#COpenTsrv##MAEHXZ) Opentsrv.obj
I traced it to the referred function but I do not know anything wrong with it ?
BOOL COpenTsrv::OnInitDialog()
{
CDialog::OnInitDialog();
CenterWindow();
acsEnumServerNames(ST_CSTA, AddToList, (unsigned long) (CComboBox*)&m_TserverListControl);
UpdateData(FALSE);
The following is the build log. Apparently there are still other errors but would like to start with the first one.
1>Generating Code...
1>Compiling resources...
1>Compiling manifest to resources...
1>Linking...
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsEnumServerNames#12 referenced in function "protected: virtual int __thiscall COpenTsrv::OnInitDialog(void)" (? OnInitDialog#COpenTsrv##MAEHXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsQueryAuthInfo#8 referenced in function "protected: void __thiscall COpenTsrv::OnSelchangeTserverlist(void)" (?OnSelchangeTserverlist#COpenTsrv##IAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsAbortStream#8 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Tsapi.obj : error LNK2001: unresolved external symbol _acsAbortStream#8
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsEventNotify#16 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _acsOpenStream#60 referenced in function "protected: virtual void __thiscall COpenTsrv::OnOK(void)" (?OnOK#COpenTsrv##MAEXXZ)
1>Opentsrv.obj : error LNK2019: unresolved external symbol _cstaMonitorDevice#20 referenced in function "protected: long __thiscall COpenTsrv::OnTsapiAcsConfirmation(unsigned int,long)" (?OnTsapiAcsConfirmation#COpenTsrv##IAEJIJ#Z)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaMakeCall#20 referenced in function "protected: void __thiscall CSampleDlg::OnCall(void)" (?OnCall#CSampleDlg##IAEXXZ)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaClearConnection#16 referenced in function "protected: void __thiscall CSampleDlg::OnHangup(void)" (?OnHangup#CSampleDlg##IAEXXZ)
1>Sampldlg.obj : error LNK2019: unresolved external symbol _cstaAnswerCall#16 referenced in function "protected: void __thiscall CSampleDlg::OnAnswer(void)" (?OnAnswer#CSampleDlg##IAEXXZ)
1>Tsapi.obj : error LNK2019: unresolved external symbol _acsGetEventPoll#20 referenced in function "protected: long __thiscall CTsapiWnd::OnTsapiMsg(unsigned int,long)" (?OnTsapiMsg#CTsapiWnd##IAEJIJ#Z)
1>C:\Users\steventang\Documents\Visual Studio 2005\Projects\TSAPINEW\Debug\TSAPINEW.exe : fatal error LNK1120: 10 unresolved externals
1>Build log was saved at "file://c:\Users\steventang\Documents\Visual Studio 2005\Projects\TSAPINEW\TSAPINEW\Debug\BuildLog.htm"
1>TSAPINEW - 12 error(s), 21 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Any help to point me to the right direction would very much be appreciated.
Thanks
Seems like your compilation was sucessfull. Only the linking did not work.
Probably the linker is complaining because you defined the header of the method "acsEnumServerNames" but you did not provide an implementation of the method.
Maybe you used a header-file but you did not provide the library to which the header belongs ?
Find out to which pakage "acsEnumServerNames" belongs and check if you have the implementation of the method in some .c/.cpp file, or if the implementation should be provided by some library on which you do rely.