The vc Code cannot be switched to linux. -- Linux general technology-Linux programming and kernel information. The following is a detailed description. Hello everyone, I am posting here for the first time, so I have no scores. Please take a look at the following questions.
This is a piece of code I wrote under VC. It can run normally under VC, but it becomes a problem when I move to linux.
Main, cpp:
# Include
# Include
Using namespace std;
# Include "anminial. h"
# Include "dog. h"
# Include "cat. h"
Cat: Cat (string name, int weight)
: Anminial (name, weight)
{
This-> name = name;
This-> weight = weight;
}
Void Cat: run ()
{
Cout <"cat is runnint" < }
Void Cat: sound ()
{
Cout <"cat is miaoing" < }
There is also a dog class, which is similar to cat and won't be written here,
In linux, many problems have occurred, most of which have been solved, but the following errors have not been found out for two days. Let's see what the problem is.
It seems that an error occurred during the connection. After searching, the general cause is that the implementation of this function cannot be found. But I don't know how to solve it.
Main. o (. text + 0x40): In function 'main ':
/Home/wanglei/test2/main. c: 31: undefined reference to 'dog: Dog [in-charge] ()'
Main. o (. text + 0x4b):/home/wanglei/test2/main. c: 32: undefined reference to 'cat: Cat [in-charge] ()'
Main. o (. text + 0x53):/home/wanglei/test2/main. c: 35: undefined reference to 'dog: run ()'
Main. o (. text + 0x5b):/home/wanglei/test2/main. c: 36: undefined reference to 'cat: run ()'
Main. o (. text + 0x85):/home/wanglei/test2/main. c: 40: undefined reference to 'dog: sound ()'
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.