|
-------------------Configuration: exc1 - Win32 Debug--------------------2 w# ^. W1 [2 w) Y
Compiling...
" J/ d) q3 _1 c% B+ m. c% Rapp.cpp
. v/ B* Y, z' Z6 \, b: t5 r! I/ _Linking...
/ Z) s: p- o$ _5 p [! Z Creating library DebUG/exc1.lib and object Debug/exc1.exp
2 O2 b0 x1 s v5 j6 o: JLINK : warning LNK4098: defaultlib "MSVCRT" conflicts with use of other libs; use /NODEFAULTLIB:library
. k- P0 [6 f7 u( R8 Wnafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argv; r& x6 B, @" k
nafxcwd.lib(appcore.obj) : error LNK2001: unresolved external symbol ___argc' d9 A# z9 d# V5 D
nafxcwd.lib(filelist.obj) : error LNK2001: unresolved external symbol __mbctype# i5 m& D4 y/ }8 K3 ]/ U1 d6 C
nafxcwd.lib(timecore.obj) : error LNK2001: unresolved external symbol __mbctype
' N9 Z. m. v! N$ q3 J1 w6 M" Znafxcwd.lib(apphelp.obj) : error LNK2001: unresolved external symbol __mbctype
& v6 b2 H8 g# [! a& W) Y+ Z5 lDebug/exc1.dll : fatal error LNK1120: 3 unresolved externals
; i/ a# S1 v5 n n; m: t执行 link.exe 时出错.
: I# a6 T6 y' M' O. W1 f# \/ I( N) `+ D% ]3 u! a
exc1.dll - 1 error(s), 0 warning(s)
/ ^6 S/ z7 s) c( q) X' f1 C! C, N
, l& ^7 u% P, w+ G( Z7 N1 x% M$ S7 o6 L+ Z3 [
原例子程序:
( P4 P# S a2 s; C0 C. O1 n9 X' `file:///C:/DOCUME~1/ADMINI~1/LOCALS~1/Temp/msohtml1/01/clip_image002.jpgMain.h文件中放置了应用文件所需的头文件、宏定义、函数与结构声明等。用户应用文件只需包含文件Main.h,就能够包含需要的所有资源。Main.cpp文件中放置工程出口(User Exit)函数,并在该函数中注册一个应用。通常情况下,User Exit函数中不含有详细代码。7 S' k. ` h1 X' T$ D
file:///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);}
+ K0 R* R2 p; q! p" g
5 U9 }0 d5 j% _& p) Q0 J; C/ ^7 v1 _# o' D# c/ Y0 t
. F* \3 h$ Z& m" B" N, e: `1 G3 H
7 E9 l/ g/ f) Y: E9 {& B% [
9 A; H" b' r1 {' n, t5 i. o& b
) H' {. z4 K$ ~8 _7 }. |* K
j1 q$ I, _$ x# N3 Q' I, ]; i( J' w5 H" u* X; }( S# x o
+ y8 m7 K# ^! J* e
|
|