I see what the problem is. Once the function is finished it deletes every local variable, including the vectors. I guess I was too tired to realize that last night.
Type: Posts; User: Tozar
I see what the problem is. Once the function is finished it deletes every local variable, including the vectors. I guess I was too tired to realize that last night.
I've spent hours narrowing my problem down to these few lines of code.
This is how my two dimensional array of classes is defined:
square board[8][8]; //Creates a 8x8 array of square...
Ooooooh, I wish I looked at that yesterday...
Solution:
vector <CP> wPawn('W'); //
This declares a vector (essentially a resizeable array) of the CP class using a constructor with parameters. It seems to dodge the previous syntax errors...
nadroj: yes, I know how to do that, read the whole topic before you post, not just the title. Thanks anyway.
Daved: Ok, I've never used vecotrs before, but I'll look it up, thanks.
It seems that these bits of code don't work:
CP wPawn('W')[8]; //expected a semi-colon
CP wPawn[8]('W'); //bad array initializer
The class:
No, the header files consisted of nothing but the function headers (within a class, however). Their .cpps werent in the same folder, but their object files were.
That's strange, I've been able to #include .h files without having to worry about adding their .cpp to the project.
Braces cause everything within them to run when followed by a true if statement. However, braces are only optional if one command line proceeds the if statement. That means if you have only one...
Whaaatt... are you saying i need to add it to every project I use it in? Does that mean I can't use it on programs with only one source file?
They always find their way into my programs!
This time I'm getting errors when I try to include my header file in two different files of the same project. The only way it works is if instead of...
Gold mine: http://www.adrianxw.dk/SoftwareSite/index.html
Many thanks to Daved for the tip, and adiranxw for the great tutorial.
Ah, this tutorial looks like a winner. I'll post again when I find something.
I was pretty sure I would have to #include <conio.h>. I'm just asking for some code that will allow me to move the output line to whatever space necessary. I remember being able to do it in Pascal;...
I'm trying to create a menu for my animal guessing game. This is the simple menu I am currently using:
do
{
system ("CLS");
cout << " | ...
Thank you very much! I had doubted that anyone could understand my problem, because even my computer science teacher was stumped. I'll definately come back to this forum next time I need help.
Error: [Linker error] undefined reference to `Node<QA>::Node(QA)'
Im writing a basic program for an animal guessing game (similar to twenty questions) using a binary search tree. The project...