こんにちは。私は Visual C++ から始めていますが、理解できないコンパイルの問題があります。
私が得るエラーは次のとおりです。
エラー LNK1120 外部リンクが未解決
エラー LNK2019
コードを貼り付けます:
C++TestingConsole.CPP
#include "stdafx.h"
#include "StringUtils.h"
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
using namespace std;
string res = StringUtils::GetProperSalute("Carlos").c_str();
cout << res;
return 0;
}
StringUtils.cpp
#include "StdAfx.h"
#include <stdio.h>
#include <ostream>
#include "StringUtils.h"
#include <string>
#include <sstream>
using namespace std;
static string GetProperSalute(string name)
{
return "Hello" + name;
}
ヘッダー: StringUtils.h
#pragma once
#include <string>
using namespace std;
class StringUtils
{
public:
static string GetProperSalute(string name);
};