Reputation: 33
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
I don't know how can I solve this problem.
this program is worked on VS2017.
but on ubuntu, not working with this problem.
what dose 'makefile:6' mean?
I can't find this on google and stack overflow.....
And, I've heard that it works even with warnings. so I didn't check these warnings.
anyway, please help..
Upvotes: 3
Views: 4212
Reputation: 18410
This
Makefile:6: recipe for target 'all' failed
means, that the target 'all', which is implicitly invoked if no other targets were specified, had errors and that it is defined in your Makefile in line 6.
The underlying error is this linker error:
undefined reference to `CarBST::CarBST()'
This is what you have to fix. The command you use to compile and link is:
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
A file CarBST.cpp
which presumably contains the class definition is present there, though. It looks like there is no parameterless constructor; either add one to the class or invoke an available constructor.
Furthermore, it is uncommon to specify header files (*.h) at the compiler command line, these are usually included in source files (*.cpp).
And lastly, you should not ignore the warnings and check, why a NULL pointer is assigned to chars. This should probably be
state = 0;
or similar.
Upvotes: 2