-2
你好我每一個想從C++代碼創建一個簡單的dll文件在visual basic 10中但這裏得到一些錯誤是代碼 這個dll的功能是輸入任何名稱並顯示的名字,當被其他應用程序(兩者都是控制檯應用程序)試圖讓win32控制檯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
請幫我