程序错误c++ 希望大佬帮忙看一下

qq_29164113 2018-05-19 09:32:18
#include "WizDemo.h"
#include <math.h>
float step;
int dir,restart,t,i;
float P_radius, P_omega, V, X, M;
Text title,title1,title2,title3,title4,title5;
ASCIIFont font;
Text text,text1;
// 构造函数
demoApp::demoApp() : WizGLApp()
{
viewMode = VIEW_PERSPECTIVE1; // 观察视角模式
demoState = DEMO_STOP; // 初始动画状态
wndWidth = 1024; // 初始窗口宽度
wndHeight = 715; // 初始窗口高度
showParamWnd = true; // 初始是否显示参数窗口
showInfoWnd = false; // 初始是否显示信息窗口
showToolbar = true; // 初始是否显示工具栏
// wiz::Assign(bgColor, 0.32f, 0.72f, 0.54f, 0.0f); // 设置背景色

}
// 析构函数
demoApp::~demoApp()
{

}
///////////////////////////////////////////////////////////////////////
// 在此创建场景
void demoApp::InitializeScenes()
{
}
// 在此创建控件
void demoApp::InitializeControls(int sceneIndex)
{
}
// 在此初始化控件参数
void demoApp::InitializeParameters(int sceneIndex)
{
P_radius =8;
P_omega =8;
V =8;
X =8;

// M=0;
}
// 场景切换时可在此作需要的设置
void demoApp::SwitchScene(int curScene, int prevScene)
{
}
///////////////////////////////////////////////////////////////////////
// 与绘图相关的初始化工作
void demoApp::SetupRC()
{
glt::SetDefaultLight();
glt::SetGlobalAmbient(wiz::cBLACK);
title.LoadWords(L"斜碰撞过程的研究", L"楷体_GB2312", 36, cBLACK, 320, 48);

}
// 绘制场景

static Color4f color1 = {0.0f,0.0f,0.0f,1.0f};
static Color4f color2 = {0.8f,0.0f,0.0f,1.0f};
static Color4f color3 = {1.f,1.0f,1.0f,1.0f};
static Color4f color4 = {0.0f,0.0f,1.0f,1.0f};
void demoApp::RenderScene(int sceneIndex)
{
Point3f p1[2],p2[2],p3[2],p4[2]; //画球
glt::SetLineWidth(2);
Orient direct = {0.0f, 0.0f};
int j;
float d,r1,r2,m1,m2,e,u1,u2,v1,a,b,k,k1;
title.Show(-35.0f, 65.0f, 1.0f);
Point3f p5[2]={{-90.0f, 0.0f, -1.0f},{90.0f, 0.0f, -1.0f}}, p6[2]={{0.0f, -60.0f, -1.0f},{0.0f, 70.0f, -1.0f}};

m1=P_radius;
m2=P_omega;
r1=6*pow(m1,1/3);
r2=6*pow(m2,1/3);
v1=V/2;
d=X*0.1*(r1+r2);
a=asin(d/(r1+r2));
glt::DisableLight();
if(GetCheck(2))title1.Show(-50.0f, 65.0f, 1.0f);
else title2.Show(-50.0f, 65.0f, 1.0f);
u2=2*m1*v1*cos(a)/(m1+m2);
u1=sqrt(v1*v1-m2*u2*u2/m1);
b=asin(m2*u2*sin(a)/(m1*u1));
k=b*180/PI;
k1=a*180/PI;
p4[1].y=p4[0].y=d; p4[1].z=p4[0].z=0; p4[1].x=100; p4[0].x=-10;



glt::SetLineWidth(2);
glt::SetLineStipple(0x0f0f, 1);
draw::Line(p4[0], p4[1], color4);
glt::SetLineStipple(0xffff, 1);
ushort str[20],str1[20];
swprintf(str, L"散射角=%.2fdeg", k);
text.LoadWords(str, L"黑体", 26, wiz::cBLACK, 256, 48); // 加载文字内容
text.Show(-25, -80, 0, true);
swprintf(str1, L"反冲角=%.2fdeg", k1);
text1.LoadWords(str1, L"黑体", 26, wiz::cBLACK, 256, 48); // 加载文字内容
text1.Show(-25, -70, 0, true);
p1[0].x=-90; p2[0].x=0;
p1[0].y=p1[1].y=d;
p2[0].y=p2[1].y=0;
p1[0].z=p1[1].z=0;
p2[0].z=p2[1].z=0;
p3[0].z=p3[1].z=0;
p4[0].z=p4[1].z=0;

for(j=1;j<step+1;j++)
{
if(j>int((90-cos(a)*(r1+r2))/v1))
{
p1[1].x=p1[0].x+u1*cos(b);
p2[1].x=p2[0].x+u2*cos(a);
p1[1].y=p1[0].y+u1*sin(b);
p2[1].y=p2[0].y-u2*sin(a);
p3[0].x=p2[0].x;
p3[1].x=p2[1].x;
p4[0].x=p2[0].x;
p4[1].x=p2[1].x;
p3[0].y=p3[1].y=0.3*(m1*u1*u1+m2*u2*u2);

draw::Line(p1[0],p1[1],color1);
draw::Line(p2[0],p2[1],color1);
draw::Line(p3[0],p3[1],color2);

}
else
{
p1[1].x=p1[0].x+v1*1;
p2[1].x=p2[0].x;
p1[1].y=p1[0].y;
p2[1].y=p2[0].y;
p3[0].x=p1[0].x;
p3[1].x=p1[1].x;
p4[0].x=p2[0].x;
p4[1].x=p2[1].x;
p3[0].y=p3[1].y=0.3*m1*v1*v1;

draw::Line(p1[0],p1[1],color1);
draw::Line(p2[0],p2[1],color1);
draw::Line(p3[0],p3[1],color2);

}
p1[0].x=p1[1].x;
p2[0].x=p2[1].x;
p1[0].y=p1[1].y;
p2[0].y=p2[1].y;
}


glt::EnableLight();
draw::Balls(1,p1+1, r1, 32, 32, color2);
draw::Balls(1,p2+1, r2, 32, 32, color3);
draw::Arrow3D(p5[0], p5[1], 0.0, 0.5, 10, 2, color3, color3, false,0,0,0);
draw::Arrow3D(p6[0], p6[1], 0.0, 0.5, 10, 2, color3, color3, false,0,0,0);





}
///////////////////////////////////////////////////////////////////////
// 动画开始
void demoApp::DemoBegin()
{ step=0; dir=0;restart=0;
t=0;
}
// 动画播放
void demoApp::DemoPlay()
{
step+=0.5;
if(step>500)step=step-500;
}
// 动画暂停
void demoApp::DemoPause()
{
}
// 动画停止
void demoApp::DemoStop()
{
}
///////////////////////////////////////////////////////////////////////
// 按钮被点击
void demoApp::ButtonClick(int sceneIndex, UINT butSN)
{

}
// 复选框被点击
void demoApp::CheckClick(int sceneIndex, UINT chkSN, bool checked)
{
}
// 单选框被点击
void demoApp::RadioClick(int sceneIndex, UINT rdoSN)
{
}
// 文本框内容被改变
void demoApp::TextboxChange(int sceneIndex, UINT txtSN)
{
}
// 组合框下拉列表项被选择
void demoApp::ComboSelChange(int sceneIndex, UINT cmbSN, int index)
{
}
// 组合框文本被改变
void demoApp::ComboTextChange(int sceneIndex, UINT cmbSN)
{
}
// 滑条被移动
void demoApp::ScrollMove(int sceneIndex, UINT sbSN, int value, float rate)
{
float param = (float)value * rate;
switch (sbSN)
{
case 1:
P_radius = param;
break;
case 2:
P_omega = param;
break;
case 3:
V = param;
break;
case 4:
X = param;
break;
case 5:
M = param;
break;
}
FlushScene();
}
///////////////////////////////////////////////////////////////////////
// 键盘建按下
void demoApp::KeyDown(UINT key)
{
}
// 键盘建松开
void demoApp::KeyUp(UINT key)
{
}
// 鼠标左键按下
void demoApp::LeftButtonDown(int x, int y, int keyFlag)
{
}
// 鼠标左键松开
void demoApp::LeftButtonUp(int x, int y, int keyFlag)
{
}
// 鼠标左键双击
void demoApp::LeftButtonDblClick(int x, int y, int keyFlag)
{
}
// 鼠标右键按下
void demoApp::RightButtonDown(int x, int y, int keyFlag)
{
}
// 鼠标右键松开
void demoApp::RightButtonUp(int x, int y, int keyFlag)
{
}
// 鼠标右键双击
void demoApp::RightButtonDblClick(int x, int y, int keyFlag)
{
}
// 鼠标移动
void demoApp::MouseMove(int x, int y, int keyFlag)
{
}
// 鼠标滚轮被滚动
void demoApp::MouseWheel(int x, int y, int zDelta, int keyFlag)
{
}


--------------------Configuration: WizDemo - Win32 Debug--------------------
Linking...
WizDemo.obj : error LNK2001: unresolved external symbol "public: __thiscall wiz::Text::Text(void)" (??0Text@wiz@@QAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: __thiscall wiz::Text::~Text(void)" (??1Text@wiz@@QAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: __thiscall wiz::ASCIIFont::ASCIIFont(void)" (??0ASCIIFont@wiz@@QAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: __thiscall wiz::ASCIIFont::~ASCIIFont(void)" (??1ASCIIFont@wiz@@QAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "protected: virtual void __thiscall wiz::WizGLApp::ProcessHits(int,unsigned int const *,int)" (?ProcessHits@WizGLApp@wiz@@MAEXHPBIH@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall wiz::WizGLApp::CommRxchar(void)" (?CommRxchar@WizGLApp@wiz@@UAEXXZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall wiz::WizGLApp::~WizGLApp(void)" (??1WizGLApp@wiz@@UAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: __thiscall wiz::WizGLApp::WizGLApp(void)" (??0WizGLApp@wiz@@QAE@XZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: bool __thiscall wiz::Text::LoadWords(unsigned short const *,unsigned short const *,int,struct wiz::Color4f const &,int,int)" (?LoadWords@Text@wiz@@QAE_NPBG0HABUColor4f@2@HH@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::SetGlobalAmbient(struct wiz::Color4f const &)" (?SetGlobalAmbient@glt@wiz@@SAXABUColor4f@2@@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::SetDefaultLight(void)" (?SetDefaultLight@glt@wiz@@SAXXZ)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::draw::Arrow3D(struct wiz::Point3f const &,struct wiz::Point3f const &,float,float,float,float,struct wiz::Color4f const &,struct wiz::Color4f const &,bool,unsi
gned int,unsigned int,unsigned int)" (?Arrow3D@draw@wiz@@SAXABUPoint3f@2@0MMMMABUColor4f@2@1_NIII@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::draw::Balls(int,struct wiz::Point3f const *,float,int,int,struct wiz::Color4f const &,unsigned int const *,bool const *,struct wiz::Color4f const &)" (?Balls@d
raw@wiz@@SAXHPBUPoint3f@2@MHHABUColor4f@2@PBIPB_N1@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::EnableLight(int)" (?EnableLight@glt@wiz@@SAXH@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::draw::Line(struct wiz::Point3f const &,struct wiz::Point3f const &,struct wiz::Color4f const &)" (?Line@draw@wiz@@SAXABUPoint3f@2@0ABUColor4f@2@@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::SetLineStipple(unsigned short,int)" (?SetLineStipple@glt@wiz@@SAXGH@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: bool __thiscall wiz::WizGLApp::GetCheck(unsigned int)" (?GetCheck@WizGLApp@wiz@@QAE_NI@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::DisableLight(int)" (?DisableLight@glt@wiz@@SAXH@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: void __thiscall wiz::Text::Show(float,float,float,bool)" (?Show@Text@wiz@@QAEXMMM_N@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: static void __cdecl wiz::glt::SetLineWidth(float)" (?SetLineWidth@glt@wiz@@SAXM@Z)
WizDemo.obj : error LNK2001: unresolved external symbol "public: void __thiscall wiz::WizGLApp::FlushScene(void)" (?FlushScene@WizGLApp@wiz@@QAEXXZ)
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/WizDemo.exe : fatal error LNK1120: 22 unresolved externals
执行 link.exe 时出错.

WizDemo.exe - 1 error(s), 0 warning(s)



...全文
1027 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
半雨微凉丶 2018-05-22
  • 打赏
  • 举报
回复
方法:错误从第一个开始排查 针对你的工程,应该是Text类相关的没找到
千寻港生惠香 2018-05-21
  • 打赏
  • 举报
回复
这个一般是函数未定义。编译器没找到相关函数定义
Isnis-fallen 2018-05-21
  • 打赏
  • 举报
回复
最有可能是没在文件里明确包含所需的库, 试试加上 #pragma comment(lib, "your lib path and name")

64,691

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧