Visual Studio 6.0, C/C++ error C2065: 'SSLv2_client_method' : undeclared identifier

Hello,

I'm using Visual C++ 6.0 in Visual Studio 6.0, SP6 on a Windows XP computer.

I'm trying to build an existing C++ source program that was originally created in Visual Studio 6.0, SP6 environment. I downloaded the source from SourceForge.net.

I have the source Workspace loaded into the C++ IDE, but when I try to Build All, it gives an error.

Here is a link of where to get this source code: https://sourceforge.net/projects/mmm3/files/magic/2.94%20b19/

Here is what I get when I try to Build\Build All:

Build Log

--------------------Configuration: Magic - Win32 ReleaseMinDep--------------------

Command Lines
Creating temporary file "C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP372.tmp" with contents
[
/nologo /Zp1 /MD /W4 /Gi /GX /O2 /I "htmlhelp" /I "ssl" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_HTML_HELP" /D "_AFXEXT" /D "_AFXDLL" /Fp"ReleaseMinDep/Magic.pch" /Yu"StdAfx.h" /Fo"ReleaseMinDep/" /Fd"ReleaseMinDep/" /FD /c 
"C:\magic-294b19-src\Mailbox.cpp"
]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP372.tmp" 
Creating temporary file "C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP373.tmp" with contents
[
/nologo /Zp1 /MD /W4 /Gi /GX /O2 /I "htmlhelp" /I "ssl" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "USE_HTML_HELP" /D "_AFXEXT" /D "_AFXDLL" /Fo"ReleaseMinDep/" /Fd"ReleaseMinDep/" /FD /c 
"C:\OpenSSL-Win32\include\openssl\applink.c"
]
Creating command line "cl.exe @C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP373.tmp" 
Creating temporary file "C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP374.tmp" with contents
[
htmlhelp/htmlhelp.lib winmm.lib /nologo /subsystem:windows /incremental:yes /pdb:"ReleaseMinDep/Magic.pdb" /machine:I386 /out:"ReleaseMinDep/Magic.exe" 
".\ReleaseMinDep\ActPPage.obj"
".\ReleaseMinDep\AdvOptionsPage.obj"
".\ReleaseMinDep\base64.obj"
".\ReleaseMinDep\blowfish.obj"
".\ReleaseMinDep\clipbrd.obj"
".\ReleaseMinDep\Color.obj"
".\ReleaseMinDep\CommandPage.obj"
".\ReleaseMinDep\cregexp.obj"
".\ReleaseMinDep\DFilters.obj"
".\ReleaseMinDep\diction.obj"
".\ReleaseMinDep\DNewImport.obj"
".\ReleaseMinDep\DPassword.obj"
".\ReleaseMinDep\EnBitmap.obj"
".\ReleaseMinDep\Excerpt.obj"
".\ReleaseMinDep\ExcerptView.obj"
".\ReleaseMinDep\GeneralPage.obj"
".\ReleaseMinDep\GetWinVer.obj"
".\ReleaseMinDep\HeaderPage.obj"
".\ReleaseMinDep\ListViewEx.obj"
".\ReleaseMinDep\LogPage.obj"
".\ReleaseMinDep\Magic.obj"
".\ReleaseMinDep\MagicDoc.obj"
".\ReleaseMinDep\MagicFrame.obj"
".\ReleaseMinDep\Mailbox.obj"
".\ReleaseMinDep\MailboxView.obj"
".\ReleaseMinDep\MD5.OBJ"
".\ReleaseMinDep\MessagePage.obj"
".\ReleaseMinDep\MIME.obj"
".\ReleaseMinDep\oneinst.obj"
".\ReleaseMinDep\OptionsPage.obj"
".\ReleaseMinDep\PlaybackPage.obj"
".\ReleaseMinDep\RawHead.obj"
".\ReleaseMinDep\REGISTRY.OBJ"
".\ReleaseMinDep\SecureString.obj"
".\ReleaseMinDep\ServerPage.obj"
".\ReleaseMinDep\StdAfx.obj"
".\ReleaseMinDep\TitleTip.obj"
".\ReleaseMinDep\tools.obj"
".\ReleaseMinDep\WatchDog.obj"
".\ReleaseMinDep\CONNECTS.OBJ"
".\ReleaseMinDep\OpenSSLConnector.obj"
".\ReleaseMinDep\OpenSSLConnectorBase.obj"
".\ReleaseMinDep\UsesOpenSSL.obj"
".\ReleaseMinDep\Magic.res"
".\ReleaseMinDep\applink.obj"
".\ReleaseMinDep\About.lib"
]
Creating command line "link.exe @C:\DOCUME~1\ADMINI~1.NEX\LOCALS~1\Temp\RSP374.tmp"
Output Window
Compiling...
Mailbox.cpp
C:\magic-294b19-src\Mailbox.cpp(333) : error C2065: 'SSLv2_client_method' : undeclared identifier
Error executing cl.exe.



Results
Magic.exe - 1 error(s), 0 warning(s)


I'm trying to fix the error on this line: "C:\magic-294b19-src\Mailbox.cpp(333) : error C2065: 'SSLv2_client_method' : undeclared identifier"

Here is the code where the error is occurring in a file called Mailbox.cpp:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
void CMailbox::SetState( int intState )
{
	if( STATE_FINAL( m_intState ) && !STATE_FINAL( intState ) )
	{
		m_strLastError.Empty();

#ifdef USE_SSL
		if (m_dwFlags & MBF_SSL)
		{
			m_pSSLctx = SSL_CTX_new(SSLv2_client_method());
			m_pSSL = SSL_new(m_pSSLctx);
			m_SSL.CreateConnector(m_pSSLctx);
			m_SSL.Create();
		}
		else
#endif
		Create();

	}


Here is the code that contains the called function in a file called ssl.h:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

/* This sets the 'default' SSL version that SSL_new() will create */
int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *meth);

# ifndef OPENSSL_NO_SSL2
const SSL_METHOD *SSLv2_method(void); /* SSLv2 */
const SSL_METHOD *SSLv2_server_method(void); /* SSLv2 */
const SSL_METHOD *SSLv2_client_method(void); /* SSLv2 */
# endif

# ifndef OPENSSL_NO_SSL3_METHOD
const SSL_METHOD *SSLv3_method(void); /* SSLv3 */
const SSL_METHOD *SSLv3_server_method(void); /* SSLv3 */
const SSL_METHOD *SSLv3_client_method(void); /* SSLv3 */
# endif 

I tried putting #include <openssl/ssl.h> in the Mailbox.cpp file.

If I change "SSLv2_client_method()" to "SSLv3_client_method()", it finds the reference and compiles without errors. If it can find it when I change it to v3, why can't it find it if it is v2?

Does anybody know how to fix this error?

Any help would be gratefully appreciated.

Thanks,
Tony
Last edited on
The function is declared only if OPENSSL_NO_SSL2 is not defined.

So what's the state of OPENSSL_NO_SSL2? Is it defined?
Hello,

I'm not sure of how to check that, but I did find this code in ssl.h:
1
2
3
4
5
6
7
8
9
10
#ifdef  __cplusplus
extern "C" {
#endif

# if (defined(OPENSSL_NO_RSA) || defined(OPENSSL_NO_MD5)) && !defined(OPENSSL_NO_SSL2)
#  define OPENSSL_NO_SSL2
# endif

# define SSL_FILETYPE_ASN1       X509_FILETYPE_ASN1
# define SSL_FILETYPE_PEM        X509_FILETYPE_PEM 


Does that mean anything?

Thanks,
Tony
It basically means that your system, as currently set up, doesn't support those functions so the programmer who wrote it isn't making them available to you. Looks like a deliberate choice of the programmer, based on your current system.
Last edited on
Hello,

I'm not sure of what you mean by "doesn't support those functions" and "isn't making them available to you".

If the programmer who wrote this application is trying to keep them from being available, why would he allow people to download the source for the whole application?

The executable download works fine. It works so good, I am trying to duplicate it to a more up to date version of C# in Visual Studio 2015.

I have requested help from the original programmer and he is not replying to my requests. That is why I came here for help.

I would like to get the source compiled so that I can see how it works using the debugger.

Thanks,
Tony
It's common, when writing C and C++ code for various target systems, to turn sections of code on and off through the use of #define and #ifdef.

For example, one might write code that used a system library if that library existed, or use other code if that system library didn't exist.

In this case, for whatever reason, when the code is compiled on your system, various of these - OPENSSL_NO_RSA OPENSSL_NO_MD5 OPENSSL_NO_SSL2 - are defined in such a way that the programmer has chosen to exclude those v2 functions.

Maybe you are intended to specifically alter those three to have those v2 functions included. Maybe your system is lacking some library or some other such that means those functions wouldn't work, so they're excluded. Generally, the build instructions for such a set of code will discuss this.
Topic archived. No new replies allowed.