大家好,我想从 Visual Basic 10 中的 c++ 代码创建一个简单的 dll 文件,但这里出现一些错误是代码,此 dll 的功能是输入任何名称并在另一个应用程序调用它时显示名称(两者都是控制台应用)
//This is demo.h file
#ifdef DEMODLL_EXPORTS
#define DEMODLL_API __declspec(dllexport)
#else
#define DEMO_API __declspec(dllimport)
#endif
namespace Demo
{
class mydemo
{
char name[30];
public:
static DEMODLL_API char getdata(char name);
static DEMODLL_API char displaydata(char name);
};
}
这是 demo.cpp 文件
#include "stdafx.h"
#include "demo.h"
#include <stdexcept>
using namespace std;
namespace Demo
{
char mydemo :: getdata(char name)
char mydemo :: displaydata(char name)
{
return name;
}
}
这些是错误
demo.h(13): error C2144: syntax error : 'char' should be preceded by ';'
demo.h(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
demo.h(13): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
demo.h(14): error C2144: syntax error : 'char' should be preceded by ';'
demo.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
demo.h(14): error C2086: 'int Demo::mydemo::DEMODLL_API' : redefinition
demo.h(13) : see declaration of 'Demo::mydemo::DEMODLL_API'
demo.h(14): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
demo.cpp(12): error C2144: syntax error : 'char' should be preceded by ';'
demo.cpp(12): error C2761: 'char Demo::mydemo::getdata(char)' : member function redeclaration not allowed
请帮我