Recently, I learned the C + + program video of dark horse. When I realized the employee management system based on polymorphism, I knocked the same code as the video, but I couldn’t compile it successfully by using vscode, and the following errors occurred:
[Employee_Management_System.cpp 2021-10-22 13:58:17.099]
,,C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x1b): undefined reference to `WorkerManager::WorkerManager()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x27): undefined reference to `WorkerManager::Show_Menu()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x44): undefined reference to `WorkerManager::~WorkerManager()'
C:\Users\AAE3~1\AppData\Local\Temp\cc7ZdaG7.o:Employee_Management_System.cpp:(.text+0x57): undefined reference to `WorkerManager::~WorkerManager()'
collect2.exe: error: ld returned 1 exit status
After querying many blogs, it is found that the causes and solutions of errors such as collect.exe: error: 1D returned 1 exit status are as follows
1. The last compiled program is not closed, that is, the black box still exists. Find it and close or restart the IDE
2. The program has no main function or the main function is misspelled
3. Running in vscode will not help you save the code. You need to save the code before running
4. The file name and file path may cause errors in some compilers
5. There is an undefined reference. This is the case for this error. When instantiating the classes of other files in the main function, you need to define the .H file and .Cpp file of other classes to solve the problem.
#include<iostream>
#include"workerManager.h"
#include"workerManager.cpp"
Read More:
- Cv2.dnn read model error [How to Solve]
- [Solved] python Connect hive to Install sasl Error: Building wheel for sasl (setup.py) … error
- [Solved] Unity Package Error: Failed running D:\Program Files\Unity2018.4.1\Editor\Data\il2cpp/build/il2cpp.exe
- [Solved] PCL Compile Error: undefined reference to `pcl::PCLBase<pcl::PointXYZRGBA>:: XXX
- Error (active) e1696 cannot open source file “errno.H” rpgworld problems encountered in installing visual studio 2017
- Clion new method shows undefined reference to solution
- [Solved] Error: Cannot find module ‘webpack-cli/package.json‘
- [Solved] NRM Error: error code: ‘err’_INVALID_ARG_Type ‘
- [Solved] Installing github.com/uudashr/gopkgs/v2/cmd/[email protected] FAILED和cannot install, GOBIN must be an ab
- [Solved] C++ error: undefined reference to `xxx‘
- [Solved] cortex_M3 freeRTOS Error: undefined reference to `_sbrk‘
- [Solved] Qt Error: undefined reference to xxxxx
- [Solved] IDEA Start Project Error: Abnormal build process termination:Could not create the Java Virtual Machine.
- [Solved] error LNK2005: _bn_sub_part_words Already defined in bn_mul.obj
- [Solved] error:#20: identifier “HAL_StatusTypeDef“ is undefined.
- Cli Write Error: This is related to npm not being able to find a file. [Solved]
- C++:error C2872: ‘byte‘: ambiguous symbol [How to Solve]
- The loop of life and death occurs when the El table component of element UI is bidirectional bound
- Error Report of Yarn Create UMI
- Error. Onload failed when ‘rjava’ was calculated in loadnamespace()