错误

    xiaoxiao2021-03-31  29

    /tmp/ccQvivp5.o: In function `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)': student.cpp:(.text+0x0): multiple definition of `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)' /tmp/ccXB2L2J.o:person.cpp:(.text+0x0): first defined here /tmp/ccQvivp5.o: In function `Person::setPerson(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)': student.cpp:(.text+0x24): multiple definition of `Person::setPerson(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)' /tmp/ccXB2L2J.o:person.cpp:(.text+0x24): first defined here /tmp/ccQvivp5.o: In function `Person::getName() const': student.cpp:(.text+0x48): multiple definition of `Person::getName() const' /tmp/ccXB2L2J.o:person.cpp:(.text+0x48): first defined here /tmp/ccQvivp5.o: In function `Person::getAge() const': student.cpp:(.text+0x68): multiple definition of `Person::getAge() const' /tmp/ccXB2L2J.o:person.cpp:(.text+0x68): first defined here /tmp/ccQvivp5.o: In function `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)': student.cpp:(.text+0x0): multiple definition of `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)' /tmp/ccXB2L2J.o:person.cpp:(.text+0x0): first defined here /tmp/ccWZXXVq.o: In function `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)': ex1.cpp:(.text+0x0): multiple definition of `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)' /tmp/ccXB2L2J.o:person.cpp:(.text+0x0): first defined here /tmp/ccWZXXVq.o: In function `Person::setPerson(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)': ex1.cpp:(.text+0x24): multiple definition of `Person::setPerson(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)' /tmp/ccXB2L2J.o:person.cpp:(.text+0x24): first defined here /tmp/ccWZXXVq.o: In function `Person::getName() const': ex1.cpp:(.text+0x48): multiple definition of `Person::getName() const' /tmp/ccXB2L2J.o:person.cpp:(.text+0x48): first defined here /tmp/ccWZXXVq.o: In function `Person::getAge() const': ex1.cpp:(.text+0x68): multiple definition of `Person::getAge() const' /tmp/ccXB2L2J.o:person.cpp:(.text+0x68): first defined here

    /tmp/ccWZXXVq.o: In function `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)':

    ex1.cpp:(.text+0x0): multiple definition of `Person::Person(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, int)'

    /tmp/ccXB2L2J.o:person.cpp:(.text+0x0): first defined here

    *****************************************************************************************************************

    我这错误也是没谁了, 写成include"person.cpp"了

    转载请注明原文地址: https://ju.6miu.com/read-665386.html

    最新回复(0)