iCAx开思工具箱

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 24533|回复: 5
打印 上一主题 下一主题

为什么调用矩阵相乘的子程序会出错

[复制链接]
跳转到指定楼层
楼主
发表于 2005-4-1 20:56:02 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
我再编程调用矩阵相乘的子程序时,编译已经通过,可连接时却出现了错误,而且错误类型相同,我不知道怎么改,所以求助高手帮忙,谢谢大家了。程序代码及错误如下:
//  Include files
#include <uf.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define UF_CALL(X) (report( __FILE__, __LINE__, #X, (X)))
static int mprd(double a[][4],double b[][4],double r[][4],int l,int n,int m,int n1,int n2,int n3)
  
{double sum;
int j,i,k,value;
  
if((l>0)&&(n>0)&&(m>0)&&(n1>=l)&&(n2>=n)&&(n3>=l))
{value=0;
for(j=1;j<=m;j++)
for(i=1;i<=l;i++)
{sum=0.0;
for(k=1;k<=n;k++)
sum+=a[k]*b[k][j];
r[j]=sum;
}
}
  
return(value);
}
static int report( char *file, int line, char *call, int irc)
{
  if (irc)
  {
     char    messg[133];
     printf("%s, line %d:  %s\n", file, line, call);
     (UF_get_fail_message(irc, messg)) ?
       printf("    returned a %d\n", irc) :
       printf("    returned error %d:  %s\n", irc, messg);
  }
  return(irc);
}
  
static void do_ugopen_api(void)
{double x[4][4]={6.872338,6.854451,6.787076,6.763157,
6.859938,6.841338,6.810069,6.774419,
6.836812,6.812599,6.774094,6.732303,
6.784929,6.752941,6.708512,6.665745};
double y[4][4]={-1.960013,-1.881351,-1.499275,-1.279834,
-1.958623,-1.879434,-1.722587,-1.494707,
-1.954809,-1.875263,-1.717429,-1.489233,
-1.946891,-1.864002,-1.699150,-1.73227};
double z[4][4]={-3.660482,-3.604488,-3.355996,-3.230086,
-3.663949,-3.609686,-3.506068,-3.365941,
-3.677516,-3.626521,-3.530772,-3.400399,
-3.718335,-3.670140,-3.578058,-3.460813};
int nstop=0,nstop1=0,nstop2=0,i,j;
int l,n,m,n1,n2,n3;
double u,w;
double bu[4][4],bw[4][4],bv[4][4],r[4][4];
char buffer[133];
u=0.5;
bu[0][0] = (1-u*u*u+3*u*u-3*u)/6;
  bu[0][1] = (3*u*u*u-6*u*u+4)/6;
  bu[0][2] = (1-3*u*u*u+3*u*u+3*u)/6;
  bu[0][3] = u*u*u/6;
  w=0.5;
  bw[0][0]= (1-w*w*w+3*w*w-3*w)/6;
  bw[1][0] = (3*w*w*w-6*w*w+4)/6;
  bw[2][0] = (1-3*w*w*w+3*w*w+3*w)/6;
bw[3][0] = w*w*w/6;
l=1,n=4,m=4,n1=1,n2=4,n3=4;
nstop=mprd(bu,x,bv,l,n,m,n1,n2,n3);
l=1,n=4,m=1,n1=1,n2=4,n3=1;
nstop=mprd(bv,bw,r,l,n,m,n1,n2,n3);
UF_UI_open_listing_window();
if(nstop==0)
for(i=0;i<1;i++)
for(j=0;j<1;j++)
  
{sprintf(buffer,"%15.7e",r[j]);
UF_UI_write_listing_window(buffer);}
l=1,n=4,m=4,n1=1,n2=4,n3=4;
nstop=mprd(bu,y,bv,l,n,m,n1,n2,n3);
l=1,n=4,m=1,n1=1,n2=4,n3=1;
nstop=mprd(bv,bw,r,l,n,m,n1,n2,n3);
if(nstop1==0)
for(i=0;i<1;i++)
for(j=0;j<1;j++)
  
{sprintf(buffer,"%15.7e",r[j]);
UF_UI_write_listing_window(buffer);}
l=1,n=4,m=4,n1=1,n2=4,n3=4;
nstop=mprd(bu,z,bv,l,n,m,n1,n2,n3);
l=1,n=4,m=1,n1=1,n2=4,n3=1;
nstop=mprd(bv,bw,r,l,n,m,n1,n2,n3);
if(nstop2==0)
for(i=0;i<1;i++)
for(j=0;j<1;j++)
  
{sprintf(buffer,"%15.7e",r[j]);
UF_UI_write_listing_window(buffer);}
}
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun )
  
#include <strstream>
  using std:strstream;
  using std::endl;  
  using std::ends;
#else
#  include <strstream.h>
#endif
#include <iostream.h>
#include "280.h"
  
//----------------------------------------------------------------------------
//  Activation Methods
//----------------------------------------------------------------------------
  
//  Unigraphics Startup
//      This entry point activates the application at Unigraphics startup
extern "C" DllExport void ufsta( char *param, int *returnCode, int rlen )
{
    /* Initialize the API environment */
    int errorCode = UF_initialize();
  
    if ( 0 == errorCode )
    {
        /* TODO: Add your application code here */
do_ugopen_api();
        /* Terminate the API environment */
        errorCode = UF_terminate();
    }
  
    /* Print out any error messages */
   &nbsprintErrorMessage( errorCode );
}
  
//----------------------------------------------------------------------------
//  Utilities
//----------------------------------------------------------------------------
  
// Unload Handler
//     This function specifies when to unload your application from Unigraphics.
//     If your application registers a callback (from a MenuScript item or a
//     User Defined Object for example), this function MUST return
//     "UF_UNLOAD_UG_TERMINATE".
extern "C" int ufusr_ask_unload( void )
{
    return( UF_UNLOAD_UG_TERMINATE );
}
  
/* PrintErrorMessage
**
**     Prints error messages to standard error and the Unigraphics status
**     line. */
static void PrintErrorMessage( int errorCode )
{
    if ( 0 != errorCode )
    {
        /* Retrieve the associated error message */
        char message[133];
        UF_get_fail_message( errorCode, message );
  
        /* Print out the message */
        UF_UI_set_status( message );
  
        // Construct a buffer to hold the text.
        ostrstream error_message;
  
        // Initialize the buffer with the required text.
        error_message << endl
                      << "Error:" << endl
                      << message
                      << endl << endl << ends;
  
      // Write the message to standard error
        cerr << error_message.str();
    }
}
Linking...
   Creating library Debug/279.lib and object Debug/279.exp
279.obj : error LNK2001: unresolved external symbol __imp__UF_terminate
279.obj : error LNK2001: unresolved external symbol __imp__UF_initialize
279.obj : error LNK2001: unresolved external symbol __imp__UF_UI_write_listing_window
279.obj : error LNK2001: unresolved external symbol __imp__UF_UI_open_listing_window
279.obj : error LNK2001: unresolved external symbol __imp__UF_UI_set_status
279.obj : error LNK2001: unresolved external symbol __imp__UF_get_fail_message
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/279.exe : fatal error LNK1120: 7 unresolved externals
Error executing link.exe.
  
279.exe - 8 error(s), 0 warning(s)
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 支持支持
沙发
发表于 2005-4-2 19:13:18 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
板凳
 楼主| 发表于 2005-4-3 09:58:47 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
地板
发表于 2005-4-3 10:28:18 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
5
 楼主| 发表于 2005-4-3 20:57:51 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
6
发表于 2005-4-4 22:42:57 | 只看该作者

马上注册登录,享用更多网站功能!

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手板模型制作,在线3D打印服务

QQ|小黑屋|手机版|开思工具箱 CAD工具箱_CAM工具箱  

GMT+8, 2024-11-16 01:33 , Processed in 0.018357 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.3

© 2002-2024 www.iCAx.org

快速回复 返回顶部 返回列表