Identifier not found?

Posts 1–3 of 3 · Page 1 of 1
Identifier not found?
Hi everyone. I was going along just fine, until I got this Identifier not found error. More specifically, it says "Keypress: Identifier not found". Essentially, I'm learning how to make a console app in C++. Here's the source:

Code:
#include "stdafx.h"

using namespace System;


int _tmain(int argc, _TCHAR* argv[])
{
	while(true)
	{
		Keypress();
	}
	return 0;
}

void Keypress()
{
	String^ line = Console::ReadLine();
	if (line->Contains("Increase"))
	{
		Console::BufferHeight += 1;
	}
}
If anyone can see what's wrong here, your input is very valued.

I have a feeling I'm about to get burned...

Nevermind, problem solved. Apparently, I had to "prototype" the function first, by defining it before the main function. Is there a rhyme/reason behind this? Does the compiler just have to "know" about it first, before it gets called?
Quote Originally Posted by UHEHsetrhthteh5ry View Post
Nevermind, problem solved. Apparently, I had to "prototype" the function first, by defining it before the main function. Is there a rhyme/reason behind this? Does the compiler just have to "know" about it first, before it gets called?
Yes, You're right to a certain point, another reason for this is c++ is highly "custimizable" (for lack of a better word). So you could for example specify an amount of bytes aswell.
Quote Originally Posted by UHEHsetrhthteh5ry View Post
Nevermind, problem solved. Apparently, I had to "prototype" the function first, by defining it before the main function. Is there a rhyme/reason behind this? Does the compiler just have to "know" about it first, before it gets called?
yes he does so he can identify on main what is that shit.
Or you can have main as last function... but thats crappy
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us