0

我正在尝试构建从我在 BMIDE 中创建的 SOA 生成的 Teamcenter ITK 项目。我在 SOA 服务中调用的方法应该从 Teamcenter 检索所有已保存的查询。我添加了所有我认为可能需要的库和依赖项。但是我仍然遇到我无法理解且不知道如何解决的错误。

我生成.hxx的文件如下:

#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

这是我生成.cxx的文件,其中包含我添加到方法中的实现:

#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;
}

在构建解决方案时,我在 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 ==========
4

1 回答 1

1

当我再次从 BMIDE 完成所有工作时,这个问题终于解决了。我猜是因为我忘记-dll libqry.lib在BMIDE 项目LINK_FLAGS的.# Platform specific options and commandsMakefile

— 里鲁

于 2021-11-14T16:04:35.367 回答