错误 LNK2019:无法解析的外部符号 vs2013

error LNK2019: unresolved external symbol vs2013

我收到此错误,但我不知道如何修复它。 我正在使用 Visual Studio 2013。

代码

-----DateUtils.h

#pragma once

#include <string>

class DateUtils
{
public:
    DateUtils();
    ~DateUtils();
    static time_t str2time_t(const std::string&, const std::string&);
};


-----ForexUtils32.h

#include <string>
// The following ifdef block is the standard way of creating macros which make exporting 
// from a DLL simpler. All files within this DLL are compiled with the FOREXUTILS32_EXPORTS
// symbol defined on the command line. This symbol should not be defined on any project
// that uses this DLL. This way any other project whose source files include this file see 
// FOREXUTILS32_API functions as being imported from a DLL, whereas this DLL sees symbols
// defined with this macro as being exported.
#ifdef FOREXUTILS32_EXPORTS
#define FOREXUTILS32_API __declspec(dllexport)
#else
#define FOREXUTILS32_API __declspec(dllimport)
#endif

// This class is exported from the ForexUtils32.dll
class FOREXUTILS32_API CForexUtils32 {
public:
    CForexUtils32(void);
    // TODO: add your methods here.
};

extern FOREXUTILS32_API int nForexUtils32;

FOREXUTILS32_API int fnForexUtils32(void);

/********************   Add Begin   *************************/
FOREXUTILS32_API time_t str2time(const std::string&, const std::string&);




/********************   Add End     *************************/


-------DateUtils.cpp

#include "stdafx.h"
#include "DateUtils.h"

#include <sstream>
#include <iomanip>

using namespace std;

DateUtils::DateUtils()
{
}


DateUtils::~DateUtils()
{
}

time_t str2time_t(const string& datetimeIn, const string& formatIn) {

    struct tm tm_time;

    // For C++11
    istringstream iss(datetimeIn);
    iss >> get_time(&tm_time, formatIn.c_str());

    time_t time = mktime(&tm_time);

    return time;

}

------ForexUtils32.cpp

// ForexUtils32.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"
#include "ForexUtils32.h"
#include "DateUtils.h"


// This is an example of an exported variable
FOREXUTILS32_API int nForexUtils32=0;

// This is an example of an exported function.
FOREXUTILS32_API int fnForexUtils32(void)
{
    return 42;
}

// This is the constructor of a class that has been exported.
// see ForexUtils32.h for the class definition
CForexUtils32::CForexUtils32()
{
    return;
}


/********************   Add Begin   *************************/
FOREXUTILS32_API time_t str2time(const std::string& datetime, const std::string& format)
{
    time_t t = DateUtils::str2time_t(datetime, format);
    return t;
}



/********************   Add End     *************************/

错误信息:

Error 1 error LNK2019: unresolved external symbol "public: static __int64 __cdecl DateUtils::str2time_t(class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &)" (?str2time_t@DateUtils@@SA_JABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) referenced in function "__int64 __cdecl str2time(class std::basic_string,class std::allocator > const &,class std::basic_string,class std::allocator > const &)" (?str2time@@YA_JABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) D:\visual studio 2013\Projectsbit\ForexUtils32\ForexUtils32\ForexUtils32.obj ForexUtils32

我该如何解决这个错误?请帮助我(我的英语不太好。谢谢)

第一行函数定义

time_t str2time_t(const string& datetimeIn, const string& formatIn) {

必须

time_t DateUtils::str2time_t(const string& datetimeIn, const string& formatIn) {

(添加成员函数所属的class名称)