读书人

C++新手提问解决方法

发布时间: 2012-02-08 19:52:21 作者: rapoo

C++新手提问
请问:编译出这种错是什么原因:
错误6error LNK2028: 无法解析的标记(0A000005) "bool __clrcall donegmu(unsigned char *,int,int,int,char *) " (?donegmu@@$$FYM_NPAEHHHPAD@Z),该标记在函数 "int __clrcall main(cli::array <class System::String ^ > ^) " (?main@@$$HYMHP$01AP$AAVString@System@@@Z) 中被引用test13.obj

再把原码附上:
// test13.cpp: 主项目文件。

#include "stdafx.h "
#include "stdio.h ";
#include "windows.h ";
#include "domegmucode.h "
using namespace System;

int main(array <System::String ^> ^args)
{
domegmucode::DataDotEncoder donegmu;
HINSTANCE myhan;
unsigned char encodeData;
char * barname= "112333.bmp ";
bool ref;
if (NULL==(myhan=LoadLibrary(TEXT( "gmuensdk.dll "))))
{
printf( "动态库调用失败 ");
exit(0);
}
printf( "请输入生成GMU码的内容: ");
scanf( "%s ",&encodeData);
printf( "%s ",&encodeData);
if(NULL==encodeData)
{
printf( "生成GMU码内容不能为空 ");
exit(0);
}
ref=donegmu(&encodeData,80,300,600,barname);
if (!ref);
{
printf( "动态库调用失败 ");
exit(0);
}
FreeLibrary(myhan);
return 0;
}


#pragma once


ref class domegmucode
{
public:
domegmucode(void);
typedef bool(__stdcall DataDotEncoder)(
unsigned char* in_data,
int data_len,
int dpi,
int dot_dis,
char* out_bmp_file);

};



[解决办法]
兄弟啊,你typedef了一个类型,声明了一个无参构造函数,没有声明这个需要5个参数的构造函数。
真是新新手啊,最基本的语法都还没学好。应该再回去认认真真看看教材的。
[解决办法]
建议你忘了自己会的delphi,买本C++ Primer从头认真学。
C++和delphi的差距是很大很大的。

读书人网 >C++

热点推荐