Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello and thank you everyone reading this, I am having a problem when I try to compile this code:
C++
#include "stdafx.h"
 
#define password "ajay"
 
int _tmain(int argc, _TCHAR* argv[])
{
char pwd[100];
printf("Please enter the password::nn");
scanf("%s", pwd);
if ( strcmp(pwd, password) == 0 )
{
printf("Congratulation!!nn");
printf("Ready to login with: %s",password);
}
else
{
printf("Wrong password");
}
getch();
return 0;
}


This the errors I get in Visual Studio Pro 2008:
error C3861: 'strcmp': identifier not found	c:\users\****\documents\visual studio 2008\projects\binarycrack\binarycrack\binarycrack.cpp	line - 13
&
error C3861: 'getch': identifier not found	c:\users\****\documents\visual studio 2008\projects\binarycrack\binarycrack\binarycrack.cpp	line - 22
Posted
Comments
Kornfeld Eliyahu Peter 18-May-14 8:08am    
It seems you missing some includes...
Can you show your stdafx.h?
SyGnUs 18-May-14 9:07am    
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//

#pragma once

#include "targetver.h"

#include <stdio.h>
#include <tchar.h>



// TODO: reference additional headers your program requires here
Kornfeld Eliyahu Peter 18-May-14 9:09am    
Than see Solution 1...
SyGnUs 18-May-14 9:28am    
So next time could I just add string.h and conio.h to that stdafx.h? or do I always have to include them in my source?
Kornfeld Eliyahu Peter 18-May-14 9:32am    
Common headers include always in stdafx.h - that's the purpose of it...

1 solution

Include "stdio.h" and "conio.h" by adding the following lines to "stdafx.h":
#include <stdio.h>
#include <conio.h>

If you already included the file and still getting the problem, add those lines in your "binarycrack.cpp" under the line '#include "stdafx.h"'.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900