|
-------------------Configuration: exc1 - Win32 Debug--------------------, m. @, y7 l+ a5 P. q
Compiling...
! A/ E3 B0 _3 i( q y3 Q( eapp.cpp+ _5 B6 b F. ]" y
Linking...
7 w! ^( p0 y: i% d+ U Creating library DebUG/exc1.lib and object Debug/exc1.exp5 z+ m W6 X3 i4 t6 Z+ E/ x
LINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
4 l' D5 ~4 ^, P Qnafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv
. l' H5 m8 S; ?( C8 Mnafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc2 }( C$ h4 e6 @6 p
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype
- g0 }- S6 i2 ?2 ^! Q$ Pnafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
$ ]8 s9 `' B) |9 f" ~nafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype* D. b1 t Y, i/ C( r0 k
Debug/exc1.dll : fatal error LNK1120: 3 unresolved externals" V: w( P1 D, y& V- {% _2 ?. y
执行 link.exe 时出错.
8 f/ z* B) R" P4 s# X3 ?6 m+ b* Z4 K& z* ~6 V- \
exc1.dll - 1 error(s), 0 warning(s)
. D4 E; a; f/ i# R; d* ?4 v
. Q1 D" W3 b" I# l: u2 c4 ~$ E% B/ L% m3 h& H, ?7 D
原例子程序:
( k0 ^& s# D) t" L' A1 qfile:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.jpgMain.h文件中放置了应用文件所需的头文件、宏定义、函数与结构声明等。用户应用文件只需包含文件Main.h,就能够包含需要的所有资源。Main.cpp文件中放置工程出口(User Exit)函数,并在该函数中注册一个应用。通常情况下,User Exit函数中不含有详细代码。
6 I9 v6 u, l9 l. Pfile:///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);}
; N- S1 ^6 }% K- l0 O! M. u! i4 j7 `6 `
% ]0 c* d( W4 i5 R4 }# e& G
/ e1 c, T# k" t- Q8 @
- y: V) M5 w% h7 q* k* V# S
4 V) t% O( I3 m, e }. z5 A4 R$ J. P9 r' j: D' J6 d/ _
" P$ }. |9 N4 n0 v' H
, p! V$ V8 o: R
, @6 j2 R) j" k/ I$ `- G |
|