Hey guys. I'm having some issues with my Visual Studio 2008 Pro. I'm trying to compile the following code, included in the link http://pastebin.com/r6WsG5r7; but, whenever I try compiling the code, I get like 5 erros: The errors are listed below.

Why is it that moving certain declarations around changes and/or removes erros?

The errors are as outlined below:

1>------ Build started: Project: brute, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.cpp(15) : error C3861: 'strcpy': identifier not found
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.cpp(24) : error C3861: 'strcmp': identifier not found
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.cpp(34) : error C3861: 'strcmp': identifier not found
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.cpp(44) : error C3861: 'strcmp': identifier not found
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.cpp(54) : error C3861: 'strcmp': identifier not found
1>Build log was saved at "file://c:\Users\ProgrammerX\Documents\Visual Studio 2008\Projects\brute\brute\Debug\BuildLog.htm"
1>brute - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Thanks, I added string.h; it cleared up my strcpy() problem, but now I'm getting about 40 errors, which include stuff like:
1>------ Build started: Project: brute, Configuration: Debug Win32 ------
1>Compiling...
1>main.c
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(16) : warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1> c:\program files\microsoft visual studio 9.0\vc\include\string.h(74) : see declaration of 'strcpy'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2143: syntax error : missing ';' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2143: syntax error : missing ';' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2143: syntax error : missing ')' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2143: syntax error : missing ';' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2065: 'i' : undeclared identifier
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2065: 'i' : undeclared identifier
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2065: 'i' : undeclared identifier
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(21) : error C2059: syntax error : ')'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(22) : error C2143: syntax error : missing ';' before '{'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(23) : error C2065: 'i' : undeclared identifier
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(31) : error C2143: syntax error : missing ';' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(31) : error C2143: syntax error : missing ';' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(31) : error C2143: syntax error : missing ')' before 'type'
1>c:\users\programmerx\documents\visual studio 2008\projects\brute\brute\main.c(31) : error C2143: syntax error : missing ';' before 'type'

First warning: disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. You don't care that VC doesn't like strcpy so turn the error off.

Next error: look on line 21 and before for the missing ';'

First warning: disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. You don't care that VC doesn't like strcpy so turn the error off.

Next error: look on line 21 and before for the missing ';'

I've tried and I really don't see any lines missing a ';'....

Well what can we say? Our crystal balls must be on the fritz. You might have to help us see your problem...

Next error: look on line 21 and before for the missing ';'

Or with errors of that nature (missing X before Y) look on the first line of code before the line given, 21 in this case particularly if Y is the first thing on the error line.

Edited 6 Years Ago by Banfa: n/a

> Looks like your paste has expired.
No it hasn't, the OP just can't paste URLs properly. Delete the trailing ;

> for(int i = 97; i >= 97 && i <= 122; i++)
Assuming you're compiling this as C, then the int declaration inside the for loop is NOT supported.
This is a C++ feature, or a C99 feature.
Since you're using m$, you're never going to get a C99 compiler.

Declare i at the start of the block, old-school style.

Comments
Good catch!!
This article has been dead for over six months. Start a new discussion instead.