How to resolve: error LNK2001: unresolved external symbol "public: static void *

  • Thread starter Thread starter mlong219
  • Start date Start date
M

mlong219

Guest
Hi All,

I'm trying to create a C++ DLL using the WinInet API, but for some odd reason, I get no errors during compiling but get external link errors regarding variables within my class. Any idea how I can resolve this?



----------------------------------------header test.h -------------------------------------------
// #include "stdafx.h"
using namespace std;
// #include <Winineti.h>
#include <windows.h>
#include <strsafe.h>
#include <wininet.h>
#include <math.h>
#include <cstring>
#include <WinInet.h>
//#include <string>
#pragma comment(lib, "wininet.lib")
#pragma comment(lib, "user32.lib")
#define FTP_FUNCTIONS_BUFFER_SIZE MAX_PATH+8


namespace Win32_FTP
{
class FTP_Win32_ClientV1
{
private:


public:
static LPCWSTR sFileSearch;
static char * sIpAddress;
static LPCWSTR sUsername;
static LPCWSTR sPassword;
static string sRemoteDir;
static string sLocalDir;
static string sFilename;
static DWORD dwError;
static HINTERNET hFTPConnect;
static HINTERNET hFind;
static HINTERNET hConnect;

static HANDLE hFile;
static WIN32_FIND_DATA FindFileData;
static string strTemp;


static __declspec(dllexport) void Test1();
static __declspec(dllexport) void FtpCloseConnection();

};
}


----------------------------------------source test.cpp -------------------------------------------

//using namespace std;
#include <iostream>
#include "test.h"
// using namespace std;


namespace Win32_FTP
{


void FTP_Win32_Client::Test1()
{
cout << "This is a test from Cplus to Csharp DLL";
}


void FTP_Win32_Client::FtpCloseConnection()
{

InternetCloseHandle(FTP_Win32_Client::hFind);
InternetCloseHandle(FTP_Win32_Client::hFTPConnect);
InternetCloseHandle(FTP_Win32_Client::hConnect);
}

}



***************************LINK ERRORS ************************
Test.obj : error LNK2001: unresolved external symbol "public: static void * Win32_FTP::FTP_Win32_Client::hFTPConnect"(?hFTPConnect@FTP_Win32_Client@Win32_FTP@@2PAXA)

Test.obj : error LNK2001: unresolved external symbol "public: static void * Win32_FTP::FTP_Win32_Client::hFind"(?hFind@FTP_Win32_Client@Win32_FTP@@2PAXA)

Test.obj : error LNK2001: unresolved external symbol "public: static void * Win32_FTP::FTP_Win32_Client::hConnect"(?hConnect@FTP_Win32_Client@Win32_FTP@@2PAXA)

Continue reading...
 
Back
Top