簡體   English   中英

在XCode和Linux上交叉編譯?

[英]Cross compiling on XCode and Linux?

我使用Xcode(5.1.1)在Mac上開發了一個相當大的應用程序。 所有代碼都可以完美運行,並且可以執行預期的操作。 但是,當我在具有gcc 4.8.3的大學linux服務器上重新編譯相同的代碼時,會出現無數的錯誤。 使用pscp命令將源代碼文件上載到服務器,因此不涉及任何形式的修改。 我的問題是:是否可以在Xcode上執行“兼容模式”,以便在上載到University服務器之前嘗試解決所有兼容性問題?

編輯:一些錯誤是:

BinarySearchTree.cpp:29:23: warning: non-static data member initializers only avau++11 [enabled by default]
     int insertCount = 0, containsCount = 0, removeCount = 0;
                       ^
BinarySearchTree.cpp:29:42: warning: non-static data member initializers only avau++11 [enabled by default]
     int insertCount = 0, containsCount = 0, removeCount = 0;
                                          ^
BinarySearchTree.cpp:29:59: warning: non-static data member initializers only avau++11 [enabled by default]
     int insertCount = 0, containsCount = 0, removeCount = 0;
                                                           ^
BinarySearchTree.cpp:30:21: warning: non-static data member initializers only avau++11 [enabled by default]
     int nodeCount = 0;
                     ^
BinarySearchTree.cpp:47:36: error: expected ',' or '...' before '&&' token
  BinarySearchTree(BinarySearchTree && rhs) : root{ rhs.root }
                                    ^
BinarySearchTree.cpp:47:42: error: invalid constructor; you probably meant 'BinarnarySearchTree<Comparable>&)'
  BinarySearchTree(BinarySearchTree && rhs) : root{ rhs.root }
                                          ^
BinarySearchTree.cpp:48:2: error: expected unqualified-id before '{' token
  {
  ^
BinarySearchTree.cpp:73:48: error: expected ',' or '...' before '&&' token
  BinarySearchTree & operator=(BinarySearchTree && rhs)
                                                ^
BinarySearchTree.cpp:153:25: error: expected ',' or '...' before '&&' token
  void insert(Comparable && x)
                         ^
BinarySearchTree.cpp:185:25: error: expected ',' or '...' before '&&' token
   BinaryNode(Comparable && theElement, BinaryNode *lt, BinaryNode *rt)
                         ^
BinarySearchTree.cpp:216:25: error: expected ',' or '...' before '&&' token
  void insert(Comparable && x, BinaryNode * & t)
                         ^
BinarySearchTree.cpp:216:7: error: 'void BinarySearchTree<Comparable>::insert(Com
  void insert(Comparable && x, BinaryNode * & t)
       ^
BinarySearchTree.cpp:153:7: error: with 'void BinarySearchTree<Comparable>::inser
  void insert(Comparable && x)
       ^
BinarySearchTree.cpp: In constructor 'BinarySearchTree<Comparable>::BinarySearchT
BinarySearchTree.cpp:32:23: warning: extended initializer lists only available wiabled by default]
  BinarySearchTree() : root{ NULL }
                       ^
BinarySearchTree.cpp: In copy constructor 'BinarySearchTree<Comparable>::BinarySeomparable>&)':
BinarySearchTree.cpp:39:51: warning: extended initializer lists only available wiabled by default]
  BinarySearchTree(const BinarySearchTree & rhs) : root{ NULL }
                                                   ^
BinarySearchTree.cpp: In member function 'BinarySearchTree<Comparable>& BinarySeanarySearchTree<Comparable>)':
BinarySearchTree.cpp:75:19: error: 'rhs' was not declared in this scope
   std::swap(root, rhs.root);
                   ^
BinarySearchTree.cpp: In member function 'void BinarySearchTree<Comparable>::inse
BinarySearchTree.cpp:155:10: error: 'move' is not a member of 'std'
   insert(std::move(x), root);
          ^
BinarySearchTree.cpp:155:20: error: 'x' was not declared in this scope
   insert(std::move(x), root);
                    ^
BinarySearchTree.cpp: In constructor 'BinarySearchTree<Comparable>::BinaryNode::BrySearchTree<Comparable>::BinaryNode*, BinarySearchTree<Comparable>::BinaryNode*)
BinarySearchTree.cpp:183:6: warning: extended initializer lists only available wiabled by default]
    : element{ theElement }, left{ lt }, right{ rt } { }
      ^
BinarySearchTree.cpp:183:29: warning: extended initializer lists only available wnabled by default]
    : element{ theElement }, left{ lt }, right{ rt } { }
                             ^
BinarySearchTree.cpp:183:41: warning: extended initializer lists only available wnabled by default]
    : element{ theElement }, left{ lt }, right{ rt } { }
                                         ^
BinarySearchTree.cpp: In constructor 'BinarySearchTree<Comparable>::BinaryNode::B
BinarySearchTree.cpp:186:6: warning: extended initializer lists only available wiabled by default]
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
      ^
BinarySearchTree.cpp:186:15: error: 'move' is not a member of 'std'
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
               ^
BinarySearchTree.cpp:186:25: error: 'theElement' was not declared in this scope
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
                         ^
BinarySearchTree.cpp:186:40: warning: extended initializer lists only available wnabled by default]
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
                                        ^
BinarySearchTree.cpp:186:46: error: 'lt' was not declared in this scope
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
                                              ^
BinarySearchTree.cpp:186:52: warning: extended initializer lists only available wnabled by default]
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
                                                    ^
BinarySearchTree.cpp:186:59: error: 'rt' was not declared in this scope
    : element{ std::move(theElement) }, left{ lt }, right{ rt } { }
                                                           ^
BinarySearchTree.cpp: In member function 'void BinarySearchTree<Comparable>::inseComparable>::BinaryNode*&)':
BinarySearchTree.cpp:202:12: warning: extended initializer lists only available wnabled by default]
    t = new BinaryNode{ x, NULL, NULL };
            ^
BinarySearchTree.cpp: In member function 'void BinarySearchTree<Comparable>::inse
BinarySearchTree.cpp:218:7: error: 't' was not declared in this scope
   if (t == NULL)
       ^
BinarySearchTree.cpp:219:12: warning: extended initializer lists only available wnabled by default]
    t = new BinaryNode{ std::move(x), NULL, NULL };
            ^
BinarySearchTree.cpp:219:24: error: 'move' is not a member of 'std'
    t = new BinaryNode{ std::move(x), NULL, NULL };
                        ^
BinarySearchTree.cpp:219:34: error: 'x' was not declared in this scope
    t = new BinaryNode{ std::move(x), NULL, NULL };
                                  ^
BinarySearchTree.cpp:220:12: error: 'x' was not declared in this scope
   else if (x < t->element)
            ^
BinarySearchTree.cpp:221:11: error: 'move' is not a member of 'std'
    insert(std::move(x), t->left);
           ^
BinarySearchTree.cpp:223:11: error: 'move' is not a member of 'std'
    insert(std::move(x), t->right);
           ^
BinarySearchTree.cpp: In member function 'void BinarySearchTree<Comparable>::remoComparable>::BinaryNode*&)':
BinarySearchTree.cpp:243:23: error: 'nullptr' was not declared in this scope
   else if (t->left != nullptr && t->right != nullptr) // Two children
                       ^
BinarySearchTree.cpp: In member function 'BinarySearchTree<Comparable>::BinaryNodclone(BinarySearchTree<Comparable>::BinaryNode*) const':
BinarySearchTree.cpp:367:15: warning: extended initializer lists only available wnabled by default]
    return new BinaryNode{ t->element, clone(t->left), clone(t->right) };
           ^

實際上,我將把我的評論擴展為答案。

評論:看起來GCC並沒有像C ++ 11那樣構建,而Xcode(LLVM,大概是)構建了。 例如,查看有關nullptr未定義的說法。

要強制LLVM像Xcode中的老式C ++編譯器一樣進行編譯,請打開您的項目設置,導航至以下設置:

在此處輸入圖片說明

...,然后選擇C ++ 98。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM