<legend id='dYAQV'><style id='dYAQV'><dir id='dYAQV'><q id='dYAQV'></q></dir></style></legend>

      <small id='dYAQV'></small><noframes id='dYAQV'>

        <bdo id='dYAQV'></bdo><ul id='dYAQV'></ul>
      <tfoot id='dYAQV'></tfoot>
        <i id='dYAQV'><tr id='dYAQV'><dt id='dYAQV'><q id='dYAQV'><span id='dYAQV'><b id='dYAQV'><form id='dYAQV'><ins id='dYAQV'></ins><ul id='dYAQV'></ul><sub id='dYAQV'></sub></form><legend id='dYAQV'></legend><bdo id='dYAQV'><pre id='dYAQV'><center id='dYAQV'></center></pre></bdo></b><th id='dYAQV'></th></span></q></dt></tr></i><div id='dYAQV'><tfoot id='dYAQV'></tfoot><dl id='dYAQV'><fieldset id='dYAQV'></fieldset></dl></div>

        体系结构 x86_64 的未定义符号:编译问题

        Undefined Symbols for architecture x86_64: Compiling problems(体系结构 x86_64 的未定义符号:编译问题)
          <bdo id='OKm5k'></bdo><ul id='OKm5k'></ul>

          <small id='OKm5k'></small><noframes id='OKm5k'>

        • <legend id='OKm5k'><style id='OKm5k'><dir id='OKm5k'><q id='OKm5k'></q></dir></style></legend>
        • <i id='OKm5k'><tr id='OKm5k'><dt id='OKm5k'><q id='OKm5k'><span id='OKm5k'><b id='OKm5k'><form id='OKm5k'><ins id='OKm5k'></ins><ul id='OKm5k'></ul><sub id='OKm5k'></sub></form><legend id='OKm5k'></legend><bdo id='OKm5k'><pre id='OKm5k'><center id='OKm5k'></center></pre></bdo></b><th id='OKm5k'></th></span></q></dt></tr></i><div id='OKm5k'><tfoot id='OKm5k'></tfoot><dl id='OKm5k'><fieldset id='OKm5k'></fieldset></dl></div>

                <tbody id='OKm5k'></tbody>
                1. <tfoot id='OKm5k'></tfoot>
                2. 本文介绍了体系结构 x86_64 的未定义符号:编译问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我正在尝试开始一项作业,我的教授给了我们一个 Main.cpp、Main.h、Scanner.cpp、Scanner.h 和一些其他实用程序.

                  So I am trying to start an assignment, my professor gives us a Main.cpp, Main.h, Scanner.cpp, Scanner.h, and some other utilities.

                  我的工作是创建一个 Similarity 类来使用余弦和 Jaccard 系数比较文档.但是,我似乎无法正确链接项目,因此我无法开始实际代码.

                  My job is to create a Similarity class to compare documents using the cosine and Jaccard coefficients. However, I can not seem to get the project linked correctly, therefore I am unable to start on the actual code.

                  在尝试了几个小时看看我做错了什么之后,我需要新的眼光来看看我做错了什么,我怀疑这很明显.

                  After trying for several hours to see what I am doing wrong, I need fresh eyes to see what I am doing wrong, I suspect it is obvious.

                  这里是 Main.cpp

                  Here is the Main.cpp

                  #include "Main.h"
                  
                  using namespace std;
                  
                  static const string TAG = "Main: ";
                  
                  int main(int argc, char *argv[])
                  {
                    string inStreamName;
                    string logStreamName;
                    string outStreamName;
                  
                    ofstream outStream;
                    string timeCallOutput;
                    Scanner inStream;
                  
                    Similarity similarity;
                  
                    ///////////////////////////////////////////////////////////////
                    // Boilerplate for naming files and opening files
                    Utils::CheckArgs(3, argc, argv, "infilename outfilename logfilename");
                    outStreamName = static_cast<string>(argv[2]);
                    logStreamName = static_cast<string>(argv[3]);
                  
                    Utils::FileOpen(outStream, outStreamName);
                    Utils::LogFileOpen(logStreamName);
                  
                    timeCallOutput = Utils::timecall("beginning");
                    Utils::logStream << timeCallOutput << endl;
                    Utils::logStream << TAG << "Beginning execution" << endl;
                  
                    Utils::logStream << TAG << "outfile '" << outStreamName << "'" << endl;
                    Utils::logStream << TAG << "logfile '" << logStreamName << "'" << endl;
                    Utils::logStream.flush();
                  
                    ///////////////////////////////////////////////////////////////
                    // What follows here is the real work of this code.
                    //   read the entire input file and echo it back
                    //   compute the two similarity coefficients
                  
                    inStreamName = static_cast<string>(argv[1]);
                    inStream.openFile(inStreamName);
                    Utils::logStream << TAG << "infile '" << inStreamName << "'" << endl;
                    Utils::logStream.flush();
                  
                    similarity.readData(inStream);
                  
                    outStream << TAG << "Data Begin
                  " << similarity.toString() << endl;
                    outStream << TAG << "Data End
                  " << endl;
                    outStream.flush();
                    inStream.close();
                  
                    outStream << TAG << "Begin similarity computation" << endl;
                    outStream << TAG << "Maximum Jaccard similarity:
                  " <<
                                         similarity.maxJaccard() << endl;
                    outStream << TAG << "Maximum cosine similarity:
                  " <<
                                         similarity.maxCosine() << endl;
                    outStream << TAG << "End similarity computation" << endl;
                    outStream.flush();
                  
                    ///////////////////////////////////////////////////////////////
                    // Boilerplate for terminating gracefully
                    Utils::logStream << TAG << "Ending execution" << endl;
                    timeCallOutput = Utils::timecall("ending");
                    Utils::logStream << timeCallOutput << endl;
                    Utils::logStream.flush();
                  
                    outStream.flush();
                    Utils::FileClose(outStream);
                  
                    Utils::FileClose(Utils::logStream);
                  
                    return 0;
                  }
                  

                  还有 Main.h

                  #ifndef MAIN_H
                  #define MAIN_H
                  
                  #include "../../Utilities/Utils.h"
                  #include "../../Utilities/Scanner.h"
                  
                  #include "Similarity.h"
                  
                  class Main
                  {
                  public:
                    int main();
                    virtual ~Main();
                  
                  private:
                  
                  };
                  
                  #endif // MAIN_H
                  

                  我的相似度.cpp

                  #include "Similarity.h"
                  
                  using namespace std;
                  
                  void readData(Scanner& inStream){
                  }
                  
                  string maxCosine(){
                      return "cosine";
                  }
                  
                  string maxJaccard(){
                      return "jaccard";
                  }
                  
                  string toString(){
                      return "toString";
                  }
                  

                  最后是我的 Similarity.h:

                  And finally my Similarity.h:

                  #ifndef SIMILARITY_H
                  #define SIMILARITY_H
                  
                  #include "../../Utilities/Scanner.h"
                  
                  class Similarity
                  {
                  public:
                      Similarity();
                      virtual ~Similarity();
                  
                      void readData(Scanner& inStream);
                      string maxCosine();
                      string maxJaccard();
                      string toString();
                  private:
                  
                  };
                  
                  #endif
                  

                  当我使用他提供的 makefile 以及为了让他的脚本能够对其进行评分而必须使用的 makefile 时,我收到此错误:

                  When I use the makefile he provided, and the one I have to use in order for his script to work to grade it I get this error:

                  g++ -O3 -Wall -o Similarity.o -c Similarity.cpp
                  g++ -O3 -Wall -o Aprog Main.o Similarity.o Scanner.o ScanLine.o Utils.o 
                  Undefined symbols for architecture x86_64:
                    "Similarity::maxJaccard()", referenced from:
                        _main in Main.o
                    "Similarity::readData(Scanner&)", referenced from:
                        _main in Main.o
                    "Similarity::toString()", referenced from:
                        _main in Main.o
                    "Similarity::maxCosine()", referenced from:
                        _main in Main.o
                    "Similarity::Similarity()", referenced from:
                        _main in Main.o
                    "Similarity::~Similarity()", referenced from:
                        _main in Main.o
                  ld: symbol(s) not found for architecture x86_64
                  collect2: ld returned 1 exit status
                  make: *** [Aprog] Error 1
                  

                  感谢您阅读所有内容,我们将不胜感激任何建议或解决方案.

                  Thank you for reading through all that, any suggestions or solutions would be greatly appreciated.

                  推荐答案

                  这里没有什么神秘之处,链接器告诉你你没有定义缺失的符号,你也没有.

                  There's no mystery here, the linker is telling you that you haven't defined the missing symbols, and you haven't.

                  Similarity::Similarity()Similarity::~Similarity() 只是缺失,而您错误地定义了其他,

                  Similarity::Similarity() or Similarity::~Similarity() are just missing and you have defined the others incorrectly,

                  void Similarity::readData(Scanner& inStream){
                  }
                  

                  不是

                  void readData(Scanner& inStream){
                  }
                  

                  等等.等

                  第二个是readData函数,只有第一个是Similarity类的readData方法.

                  The second one is a function called readData, only the first is the readData method of the Similarity class.

                  要清楚这一点,在 Similarity.h 中

                  To be clear about this, in Similarity.h

                  void readData(Scanner& inStream);
                  

                  但在 Similarity.cpp 中

                  but in Similarity.cpp

                  void Similarity::readData(Scanner& inStream){
                  }
                  

                  这篇关于体系结构 x86_64 的未定义符号:编译问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Is Type(::x); valid?(是类型(::x);有效的?)
                  Difference between an inline function and static inline function(内联函数和静态内联函数的区别)
                  Compilation fails randomly: quot;cannot open program databasequot;(编译随机失败:“无法打开程序数据库)
                  Too many initializers error for a simple array in bcc32(bcc32 中的简单数组的初始值设定项过多错误)
                  No Member named stoi in namespace std(命名空间 std 中没有名为 stoi 的成员)
                  Error using a constexpr as a template parameter within the same class(在同一个类中使用 constexpr 作为模板参数时出错)

                      <small id='iIy13'></small><noframes id='iIy13'>

                      <tfoot id='iIy13'></tfoot>

                        <i id='iIy13'><tr id='iIy13'><dt id='iIy13'><q id='iIy13'><span id='iIy13'><b id='iIy13'><form id='iIy13'><ins id='iIy13'></ins><ul id='iIy13'></ul><sub id='iIy13'></sub></form><legend id='iIy13'></legend><bdo id='iIy13'><pre id='iIy13'><center id='iIy13'></center></pre></bdo></b><th id='iIy13'></th></span></q></dt></tr></i><div id='iIy13'><tfoot id='iIy13'></tfoot><dl id='iIy13'><fieldset id='iIy13'></fieldset></dl></div>
                        <legend id='iIy13'><style id='iIy13'><dir id='iIy13'><q id='iIy13'></q></dir></style></legend>
                          <bdo id='iIy13'></bdo><ul id='iIy13'></ul>
                              <tbody id='iIy13'></tbody>