|
-------------------Configuration: exc1 - Win32 Debug--------------------( R) s& \0 r/ }5 d8 h" _
Compiling...
" n" h. L: z; a# A b p! }8 Y, p3 capp.cpp
! N2 q/ y2 {' |0 rLinking.... h( G4 W- u6 d/ b, \; F
Creating library DebUG/exc1.lib and object Debug/exc1.exp
B# Y# J8 m/ b" L" M9 N. VLINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library( n0 R% u7 A& `1 ?( o _8 U; l
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv7 d O) V2 Q h9 j
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc* y5 g# F: T/ [. `( ?
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype' {! q2 @+ I6 t8 h3 [. f2 p# [
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
! X$ ~2 s9 l0 v& cnafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype1 B. `* ?; h$ ?9 u! K: L* L1 r3 b
Debug/exc1.dll : fatal error LNK1120: 3 unresolved externals7 u$ g; X+ f1 @6 ?- N
执行 link.exe 时出错.
* \$ o1 @7 p, D; Z3 F, D( P8 a4 D' e7 v D$ p# f' k: u
exc1.dll - 1 error(s), 0 warning(s)
' z0 t2 u- f7 k/ k# _) ]
4 F+ `3 l& n+ y& n1 z3 e% A0 d/ C8 R2 X! J) X. |" j2 _
原例子程序:( E8 X$ B9 I6 ~, k
file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.jpgMain.h文件中放置了应用文件所需的头文件、宏定义、函数与结构声明等。用户应用文件只需包含文件Main.h,就能够包含需要的所有资源。Main.cpp文件中放置工程出口(User Exit)函数,并在该函数中注册一个应用。通常情况下,User Exit函数中不含有详细代码。
7 D4 G: [1 f2 P( }1 f# q! @ K. Mfile:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image004.jpg在Main.h中添加以下代码:#ifndef MAIN_H_INCLUDED#define MAIN_H_INCLUDED #include <uf.h>#include <uf_cfi.h>#include <uf_defs.h>#include <uf_exit.h>#include <uf_mb.h> #include <uf_styler.h>#include <uf_ui.h>#include <uf_assem.h>#include <uf_attr.h>#include <uf_layer.h>#include <uf_object_types.h>#include <uf_modl.h>#include <uf_disp.h>#include <uf_sket.h>#include <uf_facet.h>#include <uf_draw.h>#include <uf_part.h>#include <uf_obj.h>#include "Resource.h" #include "Application.h"//声明一个激活应用的列表结构static UF_MB_action_t act_table[] = { {"Test", [url=]NULL,[/url][微软用户1] Test, NULL }, {NULL, NULL, NULL[url=], 0[/url][微软用户2] }/* This is a NULL terminated list */};#endiffile:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image006.jpg在Main.cpp中添加如下代码:#include "stdafx.h"#include "Main.h"extern "C" DllExport void ufsta (char*param, int *retcode, int rlen){//注册菜单按钮 AFX_MANAGE_STATE(AfxgetStaticModuleState); //防止全局变量不同步而可能导致的编译出错 int error_code; if ((UF_initialize()) != 0) return; if ( (error_code = UF_MB_add _actions (act_table) )!= 0 )//注册UG应用 { charfail_message[133]=""; UF_get_fail_message(error_code, fail_message); AfxMessageBox(fail_message); } UF_terminate(); return;}file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image008.jpg在Application.h中添加如下代码,用来声明应用函数Test:UF_MB_cb_status_t Test(UF_MB_widget_t widget,UF_MB_data_t client_data, UF_MB_activated_button_p_t button);file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image010.jpg在Application.cpp中添加如下代码,实现应用函数Test:#include "stdafx.h"#include "Main.h" UF_MB_cb_status_t Test(UF_MB_widget_t widget,UF_MB_data_t client_data, UF_MB_activated_button_p_t button){/*Make sure User Function is available*/if(UF_initialize()!=0) return(UF_MB_CB_CONTINUE);uc1601("hello world",1);UF_terminate();return(UF_MB_CB_CONTINUE);} ! |+ ?! g5 k: A4 T A7 d6 i' K8 d) Q
8 E0 I+ X* ^" b/ h* `" B* K7 N
' z" R( n/ u/ a3 e
: u: E7 B- F$ J: ]+ f* P
& A8 c6 z. I0 A
4 T+ I: d* R: Q5 C1 r9 }' ~0 _0 G. P
) i0 Q; d0 {2 @6 O
7 D% N* X% s/ V+ P
. g7 p) k% V) J. x) d( z
|
|