|
-------------------Configuration: exc1 - Win32 Debug--------------------& s, l- ]$ I( Q5 G) r% U. h
Compiling...) _' S9 O+ n" G- x; E/ J' o
app.cpp
, [6 ` J4 j/ l4 X& T. BLinking...; P4 X/ L1 L- k* t
Creating library DebUG/exc1.lib and object Debug/exc1.exp
1 v' E4 J8 b" m8 m' J5 ALINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
# |( Q: O8 g& e9 i. E1 Ynafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv. G/ l, p. r; S* ]; W! ^
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc
p, ^2 G$ }, Mnafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
; s! K2 F2 K4 [2 y6 t( qnafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
: d3 `# B' b( r* K+ ^! l7 ^8 s: Jnafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
$ A9 Q1 Z4 [6 O8 RDebug/exc1.dll : fatal error LNK1120: 3 unresolved externals2 j* d& {* s+ ~+ J( f2 C
执行 link.exe 时出错.
# P' o! o8 _( |" K# \. L6 x* k% ]( Y- U8 p" [& _! g8 ~0 `5 Q
exc1.dll - 1 error(s), 0 warning(s). w8 ]2 ~# @8 N. I# l0 _) \: X/ q
% _; @! t# I+ y) G j% g1 F: ~
/ T3 ?" M" ?1 f原例子程序:
+ J2 M: x- \5 F* A; j" c$ kfile:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.jpgMain.h文件中放置了应用文件所需的头文件、宏定义、函数与结构声明等。用户应用文件只需包含文件Main.h,就能够包含需要的所有资源。Main.cpp文件中放置工程出口(User Exit)函数,并在该函数中注册一个应用。通常情况下,User Exit函数中不含有详细代码。
) x/ B% L; H. J Qfile:///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);} ' ]4 m( _: S7 n: X4 C* j1 V
- @" V% s P) I9 ^) \ d6 h7 J) q8 n0 j( T
/ M' B0 v/ U+ ]; D" `9 t: z: v" X9 T' D
2 c% V/ b, t, u. V6 u
; ?* R* e% R7 s2 N! y
5 u# N; M2 {6 E A3 T4 g) Y& \' |: V+ r' A4 M0 k% ?) a
# q* C# z! B9 l- r$ V& v |
|