C++ C++;静态库未在mac上的xcode中编译

C++ C++;静态库未在mac上的xcode中编译,c++,static-libraries,xcode9.3,C++,Static Libraries,Xcode9.3,我不熟悉堆栈溢出。我正在使用XCODE(9.3)在MAC上开发一个静态C++库。它的编译和运行都很好,但后来我做了一些代码更改,之后显示了一些奇怪的编译时错误。喜欢 “/clang:-1:链接器命令失败,退出代码为1(使用-v查看调用)”。任何帮助都将不胜感激 Undefined symbols for architecture x86_64: "LJCPPBL_CORE::LJCPPBL::Initialize(std::__1::basic_string<char, std

我不熟悉堆栈溢出。我正在使用XCODE(9.3)在MAC上开发一个静态C++库。它的编译和运行都很好,但后来我做了一些代码更改,之后显示了一些奇怪的编译时错误。喜欢 “/clang:-1:链接器命令失败,退出代码为1(使用-v查看调用)”。任何帮助都将不胜感激

    Undefined symbols for architecture x86_64:
  "LJCPPBL_CORE::LJCPPBL::Initialize(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >)", referenced from:
      _main in main.o
  "LJCPPBL_CORE::LJCPPBL::GetShortestPath(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, float*)", referenced from:
      _main in main.o
  "LJCPPBL_CORE::LJCPPBL::GetJson()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
架构x86_64的未定义符号: “LJCPPBL_CORE::LJCPPBL::Initialize(std::_1::basic_string)”,引用自: _主音中的主音 “LJCPPBL_核心::LJCPPBL::GetShortestPath(标准::基本字符串,标准::基本字符串,浮点*)”,引用自: _主音中的主音 “LJCPPBL_CORE::LJCPPBL::GetJson()”,引用自: _主音中的主音 ld:找不到架构x86_64的符号 叮当声:错误:链接器命令失败,退出代码为1(使用-v查看调用) 上面的文字显示在日志中

这是LJCPPBL头文件“ljcpbl.hpp”

\ifndef ljcpbl\u水电站
#定义LJCPPBL_水电站
#包括
#包括“./Models/Models.hpp”
#包括
#包括
使用名称空间std;
使用名称空间LJCPPBL_模型;
名称空间LJCPPBL_核心{
类ljcpbl
{
public:静态void初始化(字符串clientapkey);
public:静态字符串GetJson();
public:静态void SetJson(字符串strJson);
public:static list GetDestinationsList();
public:static list GetShortestPath(字符串源、字符串目标、float*costOfPath);
};
}
#endif/*LJCPPBL_水电站*/
这是LJCPPBL头文件“LJCPPBL.cpp”的实现

#包括
#包括“ljcpbl.hpp”
#包括“./Models/Models.hpp”
#包括“./DAL/DataAccess.cpp”
#包括“./Plugins/JsonParser/json.hpp”
#包括“SPC.cpp”
#包括“GlobalValues.cpp”
#包括
使用名称空间std;
使用名称空间ljcpbl_CORE;
使用名称空间ljcpbl_DAL;
名称空间LJCPPBL_核心{
void ljcpbl::初始化(字符串clientapkey){
自动全局值=新全局值();
ljcpblglobalvalues=*globalValues;
ljcpblglobalvalues.clientapkey=clientapkey;
}
字符串LJCPPBL::GetJson()
{
ljcpblapidal*objDAL=新的ljcpblapidal();
字符串mapPointsAndPathJson=objDAL->GetMapsAndPointsJSON();
字符串mapDestinationJSON=objDAL->GetMapDestinationsJSON();
json jsonObj={{“MapPointsAndPathJSON”,MapPointsAndPathJSON},{“MapDestinationJSON”,MapDestinationJSON};
返回jsonObj.dump();
}
void ljcpbl::SetJson(字符串strJson)
{
}
列表LJCPPBL::GetDestinationsList()
{
ljcpblapidal*objDAL=新的ljcpblapidal();
返回objDAL->GetDestinations();
}
列表LJCPPBL::GetShortestPath(字符串源、字符串目标、浮点*costOfPath)
{
返回SPC::GetShortestPath(源、目标、costOfPath);
}
}
//#恩迪夫

提前感谢您的帮助。

右键单击链接器错误并选择“在日志中显示”,这将为您提供有关错误的真实详细信息

很可能是某个未解析的外部符号,因此您可能没有将某个库或某个cpp文件链接到您的项目

编辑问题后:
似乎有一些库“ljcpbl”您还没有链接进去。至少,您尚未链接核心模块。您需要设置库路径并将库文件添加到项目中。

hey@IceFire,将您的评论作为答案发布。@AdolfoAbegg ok1。请了解如何从IDE获取可复制的文本错误消息。截图从来都不是传达这些信息的好方法。您需要在问题本身中包含一个。不接受指向第三方网站的链接。3。变化是什么?我在问题中粘贴了日志文本。你能看一看并帮我解决这个问题吗?@Bijaydix我在答案中加了一点。JCPPBL不是一个图书馆。这是我定义的一个类。我已将该类代码包含在我的code@BijayDixit那么,您是否已将cpp文件添加到项目中?是的,我已将cpp文件添加到我的项目中
#ifndef LJCPPBL_hpp
#define LJCPPBL_hpp

#include <iostream>
#include "../Models/Models.hpp"
#include <list>
#include <string.h>

using namespace std;
using namespace LJCPPBL_Models;

namespace LJCPPBL_CORE {

 class LJCPPBL
    {
        public: static void Initialize(string clientAPIKEY);
        public: static string GetJson();
        public: static void SetJson(string strJson);
        public: static list<Destination> GetDestinationsList();
        public: static list<Point> GetShortestPath(string source, string destination, float* costOfPath);
    };
}

#endif /* LJCPPBL_hpp */
#include <iostream>
#include "LJCPPBL.hpp"
#include "../Models/Models.hpp"
#include "../DAL/DataAccess.cpp"
#include "../Plugins/JsonParser/json.hpp"
#include "SPC.cpp"
#include "GlobalValues.cpp"
#include <list>

using namespace std;
using namespace LJCPPBL_CORE;
using namespace LJCPPBL_DAL;

namespace  LJCPPBL_CORE{
void LJCPPBL::Initialize(string clientAPIKEY){
        auto globalValues = new GlobalValues();
        LJCPPBLGlobalValues = *globalValues;
        LJCPPBLGlobalValues.ClientAPIKey = clientAPIKEY;
    }

    string LJCPPBL::GetJson()
    {
        LJCPPBLAPIDAL* objDAL = new LJCPPBLAPIDAL();
        string mapPointsAndPathJson = objDAL -> GetMapsAndPointsJSON();
        string mapDestinationJSON = objDAL -> GetMapDestinationsJSON();
        json jsonObj = {{"MapPointsAndPathJSON", mapPointsAndPathJson}, {"MapDestinationJSON", mapDestinationJSON} };
        return jsonObj.dump();
    }

    void LJCPPBL::SetJson(string strJson)
    {

    }

    list<Destination> LJCPPBL::GetDestinationsList()
    {
         LJCPPBLAPIDAL* objDAL = new LJCPPBLAPIDAL();
        return objDAL -> GetDestinations();
    }

    list<Point> LJCPPBL::GetShortestPath(string source, string destination, float* costOfPath)
    {
        return SPC::GetShortestPath(source, destination, costOfPath);
    }
}
//#endif