-
Dumb Question
I feel really stupid asking this, but I'm not sure what i'm missing:
(i'm using BCB6)
Code:
//---------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
#include <string>
//---------------------------------------------------------------------
#pragma resource "*.dfm"
TPasswrd *Passwrd;
void __fastcall TPasswrd::OKBtnClick(TObject *Sender)
{
char user, pass;
user = User1->Text;
pass = Pass1->Text;
if (user != "Chris" && pass != "chris1")
{
Application->MessageBoxA("Wrong password or username","ERROR",MB_OK);
User1->Clear();
Pass1->Clear();
}
else
{
Form1->File1->Enabled = true;
Form1->Encryption1->Enabled = true;
Form1->Tools1->Enabled = true;
this->Close();
}
}
it says : [C++ Error] Unit2.cpp(27): E2451 Undefined symbol 'string'
what did I miss!
thx,
DW
-
You need to use either std::string, or put 'using namespace std;' after your includes.
-
damn that was fast! thx :D
-
Is this a typo?
Code:
char user, pass;
user = User1->Text;
pass = Pass1->Text;
if (user != "Chris" && pass != "chris1")
You can't do this with char variables.
-
-
And since that message is "Wrong password or username", you might want to use || instead of && ;)