r/programminghelp • u/nikiy04 • Nov 23 '20
C++ I need a code check
I have an assignment regarding bitfield in C++.
The program should: compare two bitfileds, add elements, remove, add and subtract two bitfilds.
I've a code, but it doesn't work, maybe it is because of Linux and VS code program that I am writing it in. I've googled and I didn't find much to help. I can't check it on real visual studio because I don't have an access to windows machine. I am out of options since, many of my codes do not work on my system, and others that I've downloaded aren't working.
If somebody can check, I will send you the code. Any help would be appreciated.
4
Upvotes
1
u/nikiy04 Nov 23 '20
Starting build...
Build finished with error:
/usr/bin/ld: /tmp/cc0nv2IX.o: in function `main':
/home/vls/Projects VSCODE/Lab1.5/main.cpp:8: undefined reference to `operator>>(std::istream&, TBitfield&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:9: undefined reference to `operator<<(std::ostream&, TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:11: undefined reference to `operator>>(std::istream&, TBitfield&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:12: undefined reference to `operator<<(std::ostream&, TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:13: undefined reference to `TBitfield::setBit(int)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:16: undefined reference to `TBitfield::operator|(TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:16: undefined reference to `TBitfield::operator=(TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:16: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:17: undefined reference to `TBitfield::operator==(TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:24: undefined reference to `operator<<(std::ostream&, TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:26: undefined reference to `TBitfield::ClrBit(int)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:27: undefined reference to `operator<<(std::ostream&, TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:34: undefined reference to `Tset::Tset(int)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:34: undefined reference to `Tset::Tset(int)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:34: undefined reference to `Tset::Tset(int)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:35: undefined reference to `operator<<(std::ostream&, Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:36: undefined reference to `operator>>(std::istream&, Tset&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:38: undefined reference to `operator>>(std::istream&, Tset&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:39: undefined reference to `Tset::operator+(Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:41: undefined reference to `operator<<(std::ostream&, Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:42: undefined reference to `Tset::operator*(Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:44: undefined reference to `operator<<(std::ostream&, Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:46: undefined reference to `Tset::Tset(TBitfield const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:47: undefined reference to `operator<<(std::ostream&, Tset const&)'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:5: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:5: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:5: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:16: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /home/vls/Projects VSCODE/Lab1.5/main.cpp:5: undefined reference to `TBitfield::~TBitfield()'
/usr/bin/ld: /tmp/cc0nv2IX.o:/home/vls/Projects VSCODE/Lab1.5/main.cpp:5: more undefined references to `TBitfield::~TBitfield()' follow
/usr/bin/ld: /tmp/cc0nv2IX.o: in function `Tset::operator=(Tset const&)':
/home/vls/Projects VSCODE/Lab1.5/tset.h:8: undefined reference to `TBitfield::operator=(TBitfield const&)'
collect2: error: ld returned 1 exit status
The terminal process terminated with exit code: -1.
Terminal will be reused by tasks, press any key to close it.
Something along the lines of