链接规范无效

Invalid link specification

本文关键字:无效 范无效 链接      更新时间:2023-10-16

编译器告诉我我的代码中有 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 SpeakInternal(wstring uText, wstring uPath);

我看不出它想从我这里得到什么。

有人可以告诉我我做错了什么吗?

谢谢!

语音:

extern "C"
{
__declspec(dllexport) void __cdecl DoCompile();
__declspec(dllexport) void __cdecl SpeakInternal(wstring uText, wstring uPath);
};

语音.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#include <string>,并且在那里添加using namespace std;(这被认为是不好的风格(,或者在你所有的wstring前面加上std::