dvbbs
收藏本页
联系我们
论坛帮助
dvbbs

>> Fortran语言开发经验交流
搜一搜更多此类问题 
Fortran中文网Fortran中文网—Fortran语言经验交流Fortran语言开发经验交流 → 大家看一下这个例子彭国伦书上的画图的例子!

您是本帖的第 3598 个阅读者
树形 打印
标题:
大家看一下这个例子彭国伦书上的画图的例子!
edongliang
帅哥哟,离线,有人找我吗?
等级:论坛游民
文章:15
积分:554
门派:无门无派
注册:2007年10月31日
楼主
 用支付宝给edongliang付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给edongliang

发贴心情
大家看一下这个例子彭国伦书上的画图的例子!
大家看一下这个例子我运行以后怎么总是有错误,哪位高手给详细说明下是怎么回事?我是用console Applation 建立的工程 自由格式运行以后出现,
INK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
sglui2.obj : error LNK2001: unresolved external symbol _SGLDRAWLINE@16
Debug/76.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
76.exe - 2 error(s), 1 warning(s)
这是怎么回事啊?源程序如下
module sgl_util
  use sgl
  implicit none
  integer, save :: x=0
  integer, save :: y=0
contains
subroutine display()
  integer, parameter :: size = 10
  call sglClearBuffer()
  call sglColor3i(255,255,255)
! call sglDrawLine(x-size, y-size, x+size, y+size)
!  call sglDrawLine(x+size, y-size, x-size, y+size)
  call sglUpdateBuffer()
  return
end subroutine
subroutine MouseMove(mx,my)
  integer mx,my
  x = mx
  y = my
  call display()
  return
end subroutine
subroutine MouseDown(key)
  integer key
  write(*,"('Push mouse button ',I1)") key
end subroutine
subroutine MouseUp(key)
  integer key
  write(*,"('Release mouse button ',I1)") key
end subroutine
end module
program main
  use sgl_util
  implicit none
  ! 设定鼠标在窗口中移动时, 会调用MouseMove
  call sglMouseMoveSub(MouseMove)
  ! 设定鼠标在窗口按下按钮时, 会调用MouseDown
  call sglMouseDownSub(MouseDown) !
  ! 设定鼠标在窗口松开按钮时, 会调用MouseDown
  call sglMouseUpSub(MouseUp)
  call sglDisplaySub(display)
  call sglCreateWindow(100,100,400,400,1)
  call sglShowCursor(0) ! 隐藏操作系统的鼠标光标
  call sglMainLoop()
  stop
end program
ip地址已设置保密
2008/5/7 9:17:59
lm_lxt
帅哥哟,离线,有人找我吗?
等级:版主
文章:480
积分:3912
门派:无门无派
注册:2006年4月21日
2
 用支付宝给lm_lxt付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给lm_lxt

发贴心情
好像http://bbs.pfan.cn/论坛里出现过类似的问题,找找看

http://lmlxt.spaces.live.com/
ip地址已设置保密
2008/5/7 12:03:28
edongliang
帅哥哟,离线,有人找我吗?
等级:论坛游民
文章:15
积分:554
门派:无门无派
注册:2007年10月31日
3
 用支付宝给edongliang付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给edongliang

发贴心情

那个帖子我回了我把程序加进去就行了我回他了

ip地址已设置保密
2008/5/7 18:28:39
珊瑚虫
帅哥哟,离线,有人找我吗?
等级:论坛游民
文章:66
积分:1242
门派:无门无派
注册:2007年10月27日
4
 用支付宝给珊瑚虫付款或购买其商品,支付宝交易免手续费、安全、快捷! 点击这里发送电子邮件给珊瑚虫

发贴心情

这个程序是有问题

以下是我改的

module sgl_util
  use sgl
  implicit none
  integer, save :: x=0
  integer, save :: y=0
contains
subroutine display()
  integer, parameter :: size = 10
  call sglClearBuffer()
  call sglColor3i(255,255,255)
  call sglLine(x-size, y-size, x+size, y+size)
  call sglLine(x+size, y-size, x-size, y+size)
  call sglUpdateBuffer()
  return
end subroutine
subroutine MouseMove(mx,my)
  integer mx,my
  x = mx
  y = my
  call display()
  return
end subroutine
subroutine MouseDown(key,x,y)
  integer key,x,y
  write(*,"('Push mouse button ',I1)") key
  write(*,*)'坐标:',x,y
end subroutine
subroutine MouseUp(key,x,y)
  integer key,x,y
  write(*,"('Release mouse button ',I1)") key
end subroutine
end module

program main
  use sgl_util
  implicit none
  call sglMouseMoveSub(MouseMove)
  call sglMouseDownSub(MouseDown)
  call sglMouseupSub(Mouseup)
  call sglDisplaySub(display)
  call sglCreateWindow(100,100,400,400,1)
  call sglShowCursor(0)
  call sglMainLoop()
  stop
end program

大概是他在调用MouseUp(key,x,y)这几个子程序是变量有问题吧

这样改了之后就好了

ip地址已设置保密
2008/5/8 17:20:01

 4   4   1/1页      1    
网上贸易 创造奇迹! 阿里巴巴 Alibaba
Powered By Dvbbs Version 7.1.0 Sp1
Copyright ©2005 - 2008 www.fortran.cn
页面执行时间 0.09375 秒, 5 次数据查询
京ICP备05056801号