首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >makefile:6:在ubuntu-16.04上目标“全部”失败的配方

makefile:6:在ubuntu-16.04上目标“全部”失败的配方
EN

Stack Overflow用户
提问于 2018-09-30 16:54:14
回答 1查看 3.4K关注 0票数 3
代码语言:javascript
复制
g++ -std=c++11 -g -o run NumberNode.cpp LinkedList.cpp CarBST.cpp Queue.cpp CarNode.cpp Manager.cpp main.cpp NumberBST.cpp CarBST.h Queue.h CarNode.h Manager.h NumberBST.h NumberNode.h LinkedList.h
In file included from CarBST.h:2:0,
                 from NumberNode.h:2,
                 from NumberNode.cpp:1:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
NumberNode.cpp: In destructor ‘NumberNode::~NumberNode()’:
NumberNode.cpp:13:9: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
  number = NULL;
         ^
In file included from LinkedList.h:2:0,
                 from LinkedList.cpp:1:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
In file included from CarBST.h:2:0,
                 from CarBST.cpp:1:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
CarBST.cpp: In member function ‘void CarBST::Delete(int)’:
CarBST.cpp:90:21: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
  int lastLocation = NULL; //leafNode \B0\E6\BF\EC \BAθ\F0\B3\EB\B5\E5\C0\C7 \B
                     ^
In file included from Queue.h:2:0,
                 from Queue.cpp:1:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
In file included from CarNode.cpp:1:0:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
CarNode.cpp: In destructor ‘CarNode::~CarNode()’:
CarNode.cpp:12:12: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
  carNumber = NULL;
            ^
CarNode.cpp:14:8: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
  state = NULL;
        ^
In file included from LinkedList.h:2:0,
                 from Manager.h:11,
                 from Manager.cpp:6:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
In file included from LinkedList.h:2:0,
                 from Manager.h:11,
                 from main.cpp:3:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
In file included from CarBST.h:2:0,
                 from NumberNode.h:2,
                 from NumberBST.h:2,
                 from NumberBST.cpp:1:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
NumberBST.cpp: In member function ‘void NumberBST::Delete(int)’:
NumberBST.cpp:119:21: warning: converting to non-pointer type ‘int’ from NULL [-Wconversion-null]
  int lastLocation = NULL; //leafNode \B0\E6\BF\EC \BAθ\F0\B3\EB\B5\E5\C0\C7 \B
                     ^
CarBST.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from CarBST.h:2:0:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
Queue.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from Queue.h:2:0:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
CarNode.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
Manager.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from LinkedList.h:2:0,
                 from Manager.h:11:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
NumberBST.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from CarBST.h:2:0,
                 from NumberNode.h:2,
                 from NumberBST.h:2:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
NumberNode.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from CarBST.h:2:0,
                 from NumberNode.h:2:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
LinkedList.h:1:9: warning: #pragma once in main file
 #pragma once
         ^
In file included from LinkedList.h:2:0:
CarNode.h: In constructor ‘CarNode::CarNode(int)’:
CarNode.h:24:9: warning: converting to non-pointer type ‘char’ from NULL [-Wconversion-null]
   state = NULL;
         ^
/tmp/ccYwuJus.o: In function `Manager::MOVE(int)':
/home/limsh/project/Manager.cpp:172: undefined reference to `CarBST::CarBST()'
/tmp/ccYwuJus.o: In function `Manager::Insert_BST(std::basic_ifstream<char, std::char_traits<char> >&)':
/home/limsh/project/Manager.cpp:363: undefined reference to `CarBST::CarBST()'
collect2: error: ld returned 1 exit status
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 1

我不知道怎样才能解决这个问题。

这个程序是在VS2017上工作的。

但是在ubuntu上,没有解决这个问题。

什么是“制造”:6?

我在google和堆栈溢出上找不到这个.

而且,我听说即使是警告也能起作用。所以我没有检查这些警告。

不管怎样,请你帮忙..。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-09-30 17:11:04

代码语言:javascript
复制
Makefile:6: recipe for target 'all' failed

这意味着,如果没有指定其他目标,则隐式调用的目标'all‘存在错误,并且它是在第6行的Makefile中定义的。

基本错误是这个链接器错误:

代码语言:javascript
复制
undefined reference to `CarBST::CarBST()'

这就是你要解决的问题。用于编译和链接的命令是:

代码语言:javascript
复制
g++ -std=c++11 -g -o run NumberNode.cpp LinkedList.cpp CarBST.cpp Queue.cpp CarNode.cpp Manager.cpp main.cpp NumberBST.cpp CarBST.h Queue.h CarNode.h Manager.h NumberBST.h NumberNode.h LinkedList.h

不过,存在一个大概包含类定义的文件CarBST.cpp。它似乎没有无参数的构造函数;要么向类添加一个构造函数,要么调用可用的构造函数。

此外,在编译器命令行中指定头文件(*.h)并不常见,这些文件通常包含在源文件(*.cpp)中。

最后,您不应该忽略警告并检查为什么将空指针分配给字符。这可能应该是

代码语言:javascript
复制
state = 0;

或者类似的。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52580082

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档