When I try to Compile or Build All I get undefined references:
C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x67): undefined reference to BlackJackTutorManager::BlackJackTutorManager()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0xac): undefined reference to BlackJackTutorManager::initValues()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x584): undefined reference to BlackJackTutorManager::dealNewDeck()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x5c6): undefined reference to BlackJackTutorManager::decide(int)' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x5ea): undefined reference to `BlackJackTutorManager::why()'
C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x80): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xb9): undefined reference to BlackJackTutorTerminalIo::clearYourCard(unsigned int)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x170): undefined reference to BlackJackTutorTerminalIo::isPairTest()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x1a7): undefined reference to BlackJackTutorTerminalIo::isAxTest()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x20a): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x24f): undefined reference to BlackJackTutorTerminalIo::setDealersCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x265): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x2a8): undefined reference to BlackJackTutorTerminalIo::clearYourCard(unsigned int)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x2ff): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x361): undefined reference to BlackJackTutorTerminalIo::setDealersCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x377): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x3d7): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x615): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x7f7): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x8ec): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x961): undefined reference to BlackJackTutorTerminalIo::getAlwaysWhy()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9ae): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9bd): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9ed): undefined reference to BlackJackTutorTerminalIo::setInfo(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xa0d): undefined reference to BlackJackTutorTerminalIo::getAlwaysWhy()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xa62): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xbc0): undefined reference to BlackJackTutorTerminalIo::setGrade(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xc32): undefined reference to `BlackJackTutorTerminalIo::setInfo(char)'
C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x27): undefined reference to BlackJackTutorTerminalIo::BlackJackTutorTerminalIo()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x37): undefined reference to BlackJackTutorTerminalIo::promptProperties()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x43): undefined reference to BlackJackTutorTerminalIo::initValues()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x4f): undefined reference to BlackJackTutorTerminalIo::promptChoice()'
Also, when I try to compile a single source, Dev-C++ outputs an exec instead of an object file, e.g.:
In Dev-C++ this project is set up as a console app, otherwise the settings are default (except parameter to eliminate multiple definitions).
I would think that Dev C++ would compile the two classes, create object files, and resolve the undefined references when it links. What am I missing here?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not an expert on this, but from what I am seeing here I can see that there are a lot of errors attributed not finding functions such as
undefined reference to BlackJackTutorTerminalIo::BlackJackTutorTerminalIo()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x37)
This is saying the compiler can't find BlackJackTutorTerminallo::BlackJackTutorTerminallo() function inside main.cpp, among a lot of others, which is a function inside the BlackJackTutorTerminallo:: scope. This function prototype must be defined in a header file, and then the .h file must be included for the compiler to find the function itself. Undefined reference means it can't find it. This might be something as simple as not including the header file(s)!!! In the header file there in usually a piece of def code such as the following:
ifndef BISTREE_H
define BISTREE_H
include "bitree.h"
-------- code here ----------
endif
This piece of include code lets the compiler see your function prototypes so the compiler knows what to do with the function when it sees it during the compile process. The code above lets the compiler know only once what the function prototypes are. In your program the compiler doesn't know that the function exists because it is not seeing it in the header file. Look at your includes.
syd/wt1v
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I recognize how irritating this can be, however there are a few guidelines I have that would possibly assist you get to the bottom of the problem.
Firstly, ensure that you have included all the necessary header files and libraries in your project. Sometimes, missing dependencies can lead to undefined reference errors.
Another important thing to check is whether you have correctly defined all your functions and classes. It's crucial to declare them before they are used in your code.
Remember, these are just my personal opinions and suggestions based on the information provided.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am new to Dev C++ (5.1) on Windows 10. I typically do my C++ development on RedHat Linux.
In Dev-C++, I've created a project with two classes:
BlackJackTutorManager
BlackJackTutorTerminalIo
BlackJackTutorManager calls methods in BlackJackTutorTerminalIo and vice versa, e.g.
When I try to Compile or Build All I get undefined references:
C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x67): undefined reference to BlackJackTutorManager::BlackJackTutorManager()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0xac): undefined reference to BlackJackTutorManager::initValues()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x584): undefined reference to BlackJackTutorManager::dealNewDeck()' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x5c6): undefined reference to BlackJackTutorManager::decide(int)' C:\Users\Owner\AppData\Local\Temp\cca9k4mX.o:BlackJackTutorTerminalIo.cpp:(.text+0x5ea): undefined reference to `BlackJackTutorManager::why()'
C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x80): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xb9): undefined reference to BlackJackTutorTerminalIo::clearYourCard(unsigned int)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x170): undefined reference to BlackJackTutorTerminalIo::isPairTest()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x1a7): undefined reference to BlackJackTutorTerminalIo::isAxTest()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x20a): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x24f): undefined reference to BlackJackTutorTerminalIo::setDealersCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x265): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x2a8): undefined reference to BlackJackTutorTerminalIo::clearYourCard(unsigned int)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x2ff): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x361): undefined reference to BlackJackTutorTerminalIo::setDealersCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x377): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x3d7): undefined reference to BlackJackTutorTerminalIo::setYourCard(unsigned int, char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x615): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x7f7): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x8ec): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x961): undefined reference to BlackJackTutorTerminalIo::getAlwaysWhy()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9ae): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9bd): undefined reference to BlackJackTutorTerminalIo::isDoubleAfterSplit()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0x9ed): undefined reference to BlackJackTutorTerminalIo::setInfo(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xa0d): undefined reference to BlackJackTutorTerminalIo::getAlwaysWhy()' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xa62): undefined reference to BlackJackTutorTerminalIo::setComments(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xbc0): undefined reference to BlackJackTutorTerminalIo::setGrade(char)' C:\Users\Owner\AppData\Local\Temp\ccNp8mpT.o:BlackJackTutorManager.cpp:(.text+0xc32): undefined reference to `BlackJackTutorTerminalIo::setInfo(char)'
C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x27): undefined reference to BlackJackTutorTerminalIo::BlackJackTutorTerminalIo()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x37): undefined reference to BlackJackTutorTerminalIo::promptProperties()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x43): undefined reference to BlackJackTutorTerminalIo::initValues()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x4f): undefined reference to BlackJackTutorTerminalIo::promptChoice()'
Also, when I try to compile a single source, Dev-C++ outputs an exec instead of an object file, e.g.:
Command: g++.exe "C:\Users\Owner\OneDrive\Documents\BJT\BlackJackTutorManager.cpp" -o "C:\Users\Owner\OneDrive\Documents\BJT\BlackJackTutorManager.exe" -I"%CppIncludeDir0%" -I"%CppIncludeDir1%" -I"%CppIncludeDir2%" -I"%CppIncludeDir2%\c++" -L"%LibDir0%" -L"%LibDir1%" -static-libgcc
I have no idea what tells Dev-C++ to do that.
In Dev-C++ this project is set up as a console app, otherwise the settings are default (except parameter to eliminate multiple definitions).
I would think that Dev C++ would compile the two classes, create object files, and resolve the undefined references when it links. What am I missing here?
I'm not an expert on this, but from what I am seeing here I can see that there are a lot of errors attributed not finding functions such as
undefined reference to BlackJackTutorTerminalIo::BlackJackTutorTerminalIo()' C:\Users\Owner\AppData\Local\Temp\ccfc3TqP.o:main.cpp:(.text+0x37)
This is saying the compiler can't find BlackJackTutorTerminallo::BlackJackTutorTerminallo() function inside main.cpp, among a lot of others, which is a function inside the BlackJackTutorTerminallo:: scope. This function prototype must be defined in a header file, and then the .h file must be included for the compiler to find the function itself. Undefined reference means it can't find it. This might be something as simple as not including the header file(s)!!! In the header file there in usually a piece of def code such as the following:
ifndef BISTREE_H
define BISTREE_H
include "bitree.h"
-------- code here ----------
endif
This piece of include code lets the compiler see your function prototypes so the compiler knows what to do with the function when it sees it during the compile process. The code above lets the compiler know only once what the function prototypes are. In your program the compiler doesn't know that the function exists because it is not seeing it in the header file. Look at your includes.
syd/wt1v
take a look at the latest version https://sourceforge.net/projects/embarcadero-devcpp/
I recognize how irritating this can be, however there are a few guidelines I have that would possibly assist you get to the bottom of the problem.
Firstly, ensure that you have included all the necessary header files and libraries in your project. Sometimes, missing dependencies can lead to undefined reference errors.
Another important thing to check is whether you have correctly defined all your functions and classes. It's crucial to declare them before they are used in your code.
Remember, these are just my personal opinions and suggestions based on the information provided.