Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build failed collect2: error: ld returned 1 exit status #1

Open
Sirius-1110 opened this issue May 13, 2024 · 0 comments
Open

build failed collect2: error: ld returned 1 exit status #1

Sirius-1110 opened this issue May 13, 2024 · 0 comments

Comments

@Sirius-1110
Copy link

(base) ci@cidi-NUC9i9QNX:~/Documents/doxygen-demo/build$ make
[  7%] Building CXX object src/CMakeFiles/circle.dir/circle.cpp.o
[ 14%] Linking CXX static library libcircle.a
[ 14%] Built target circle
[ 21%] Building CXX object src/CMakeFiles/point.dir/point.cpp.o
[ 28%] Linking CXX static library libpoint.a
[ 28%] Built target point
[ 35%] Building CXX object src/CMakeFiles/rectangle.dir/rectangle.cpp.o
[ 42%] Linking CXX static library librectangle.a
[ 42%] Built target rectangle
[ 50%] Building CXX object src/CMakeFiles/shape.dir/shape.cpp.o
[ 57%] Linking CXX static library libshape.a
[ 57%] Built target shape
[ 64%] Building CXX object src/CMakeFiles/shapefactory.dir/shapefactory.cpp.o
[ 71%] Linking CXX static library libshapefactory.a
[ 71%] Built target shapefactory
[ 78%] Building CXX object src/CMakeFiles/triangle.dir/triangle.cpp.o
[ 85%] Linking CXX static library libtriangle.a
[ 85%] Built target triangle
[ 92%] Building CXX object src/CMakeFiles/shape_demo.dir/main.cpp.o
[100%] Linking CXX executable shape_demo
/usr/bin/ld: libshapefactory.a(shapefactory.cpp.o): in function `RandomSizeShapeFactory::createShape(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
shapefactory.cpp:(.text+0x124): undefined reference to `Circle::Circle(int, int, int)'
/usr/bin/ld: shapefactory.cpp:(.text+0x173): undefined reference to `Rectangle::Rectangle(int, int, int, int)'
/usr/bin/ld: libtriangle.a(triangle.cpp.o): in function `Triangle::Triangle(int, int, int, int)':
triangle.cpp:(.text+0x2d): undefined reference to `Shape::Shape(int, int)'
/usr/bin/ld: libtriangle.a(triangle.cpp.o): in function `Triangle::Triangle(int, int, Point)':
triangle.cpp:(.text+0x7f): undefined reference to `Shape::Shape(Point)'
collect2: error: ld returned 1 exit status
make[2]: *** [src/CMakeFiles/shape_demo.dir/build.make:103:src/shape_demo] 错误 1
make[1]: *** [CMakeFiles/Makefile2:271:src/CMakeFiles/shape_demo.dir/all] 错误 2
make: *** [Makefile:91:all] 错误 2
@Sirius-1110 Sirius-1110 changed the title build failed build failed collect2: error: ld returned 1 exit status May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant