fstream helpp

hello again everyone, The error is on line 52... any help will be appreciated!
Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 #include<iostream>
#include<algorithm>
#include<windows.h>
#include<fstream>
#include<string>
#include<conio.h>


using namespace std;

int main()
{
    string text, filename;
    system("title encrypter");
    cout<<"Enter the file to encrypt: ";
    cin>>filename;
    filename = filename+".crypt";
    ofstream myfile(filename.c_str());
    Sleep(1250);
    system("cls");
    cout<<"Press escape to terminate typing.\nStart typing your message:\n";
    while(true)
    {
        getline(cin, text);
        replace(text.begin(), text.end(), 'a', ',');
        replace(text.begin(), text.end(), 'b', '<');
        replace(text.begin(), text.end(), 'c', '>');
        replace(text.begin(), text.end(), 'd', '?');
        replace(text.begin(), text.end(), 'e', '/');
        replace(text.begin(), text.end(), 'f', '|');
        replace(text.begin(), text.end(), 'g', '"');
        replace(text.begin(), text.end(), 'h', ':');
        replace(text.begin(), text.end(), 'i', ';');
        replace(text.begin(), text.end(), 'j', '}');
        replace(text.begin(), text.end(), 'k', '{');
        replace(text.begin(), text.end(), 'l', ']');
        replace(text.begin(), text.end(), 'm', '[');
        replace(text.begin(), text.end(), 'n', '+');
        replace(text.begin(), text.end(), 'o', '_');
        replace(text.begin(), text.end(), 'p', ')');
        replace(text.begin(), text.end(), 'q', '(');
        replace(text.begin(), text.end(), 'r', '*');
        replace(text.begin(), text.end(), 's', '&');
        replace(text.begin(), text.end(), 't', '^');
        replace(text.begin(), text.end(), 'u', '%');
        replace(text.begin(), text.end(), 'v', '$');
        replace(text.begin(), text.end(), 'w', '#');
        replace(text.begin(), text.end(), 'x', '@');
        replace(text.begin(), text.end(), 'y', '!');
        replace(text.begin(), text.end(), 'z', '~');
        replace(text.begin(), text.end(), ' ', '`');
        myfile<<text<<endl;
        if(getch() == VK_ESCAPE){
            cout<<endl<<"FINISHED!!!";
            system("pause");
            return 0;
        }
    }
    system("pause");
    return 0;
}


The error is on line 52... any help will be appreciated!
What is the error text states?

(BTW, code looks completely correct)
I know it is correct but it gives like 50 errors...:

C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `SetTextColor@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `CreateCompatibleDC@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `CreateCompatibleBitmap@12'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `GetStockObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `DPtoLP@12'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winthread.o):winthread.cxx|| undefined reference to `BitBlt@36'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `ExtCreatePen@20'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetPixel@12'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetPixel@12'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetPixel@12'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetCurrentPositionEx@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetCurrentPositionEx@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `GetCurrentPositionEx@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `MoveToEx@16'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `MoveToEx@16'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `SetBkColor@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `SetTextColor@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreateBitmap@20'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreatePatternBrush@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreateBitmap@20'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreatePatternBrush@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `SelectObject@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `DeleteObject@4'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreateHatchBrush@8'|
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(misc.o):misc.cxx|| undefined reference to `CreateSolidBrush@4'|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
||=== Build failed: 50 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
This code worked fine for me. I'm using Code::Blocks 13.12.
Remove line 6 and 53-57. If it compiles afterward, then terribly outdated conio.h is not working animore for you. Find a replacement
It is actually that getch() should be _getch()

I just saw, but many thanks for the help(and sorry for the double posting)
Topic archived. No new replies allowed.