C++ 无效的链接规范
编译器告诉我代码中有3个错误:C++ 无效的链接规范,c++,visual-studio-2019,C++,Visual Studio 2019,编译器告诉我代码中有3个错误: Linking specification incompatible with "SpeakInternal" (declare in line 13 of voice.cpp) (previously) wstring: not declared identifier Syntax error: Missing ")" before identifier "uText" 代码是: __declspec(dllexport) void __cdecl Spe
Linking specification incompatible with "SpeakInternal" (declare in line 13 of voice.cpp) (previously)
wstring: not declared identifier
Syntax error: Missing ")" before identifier "uText"
代码是:
__declspec(dllexport) void __cdecl SpeakInternal(wstring uText, wstring uPath);
我看不出它想从我这里得到什么
谁能告诉我我做错了什么
多谢各位
声音.h:
extern "C"
{
__declspec(dllexport) void __cdecl DoCompile();
__declspec(dllexport) void __cdecl SpeakInternal(wstring uText, wstring uPath);
};
voice.cpp:
// voice.cpp : Defines the exported functions for the DLL application.
//
#include "stdafx.h"
#include "voice.h"
#include "app.h"
void DoCompile()
{
CApp nApp;
nApp.DoCompile();
}
void SpeakInternal(wstring uText, wstring uPath)
{
CApp nApp;
//nApp.SpeakThis()
}
您必须
#在voice.h
中包含,并使用名称空间std添加代码>在那里(这被认为是不好的风格),或者用std::
在wstring
前面加上你删除的必要内容(如果我把它们加回去-你现在肯定知道如何显示)请准确的错误消息。@RichardCriten我已经添加了它们,事实上它们是3。