Fortran Coder

标题: SimplyFortran调用appGraphics问题 [打印本页]

作者: fpchi9103    时间: 2018-10-18 15:21
标题: SimplyFortran调用appGraphics问题
最近安装了simply Fortran,看见帮助文档里面有appGraphics,就想学学做界面,但是按照help文档里的例子做,却提示出错
程序:
[Fortran] 纯文本查看 复制代码
program main
use appgraphics
implicit none
    integer::myscreen
    integer :: root_menu,file_menu,item
   
    interface
        subroutine quit()
        end subroutine quit
    end interface
    interface
        subroutine save()
        end subroutine save
    end interface
   
    myscreen = initwindow(800, 600, closeflag=.TRUE.)
   
    call loop()
    root_menu = addmenu("", MENU_FOR_WINDOW)
    file_menu = addmenu("File", root_menu)
    item = addmenuitem("Save", file_menu, save)
    item = addmenuitem("Quit", file_menu, quit)
   
    call closewindow(myscreen)
end program main


错误提示:
Generating Makefile... Okay
==============================================================================
Processing default resource
Generating graphics.exe
build\main.o: In function `MAIN__':
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C:\Users\fpchi\Fortran\Empty/./main.f90:24: undefined reference to `save_'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C:\Users\fpchi\Fortran\Empty/./main.f90:25: undefined reference to `quit_'
collect2.exe: error: ld returned 1 exit status
Error: Last command making (graphics.exe) returned a bad status
Error: Make execution terminated
* Failed *

请教是什么原因,是需要一些额外的设置么?


作者: fpchi9103    时间: 2018-10-18 15:57
明白了,那个“save”和“quit”是自己写的过程名。。。还以为是编译器已经给写好的。。。
作者: vvt    时间: 2018-10-18 16:16
这俩函数需要你自己写。写俩空白的就好了。
[Fortran] 纯文本查看 复制代码
program main
use appgraphics
implicit none
    integer::myscreen
    integer :: root_menu,file_menu,item

    interface
        subroutine quit()
        end subroutine quit
    end interface
    interface
        subroutine save()
        end subroutine save
    end interface

    myscreen = initwindow(800, 600, closeflag=.TRUE.)
    root_menu = addmenu("", MENU_FOR_WINDOW)
    file_menu = addmenu("File", root_menu)
    item = addmenuitem("Save", file_menu, save)
    item = addmenuitem("Quit", file_menu, quit)
    call loop()
    call closewindow(myscreen)
end program main

  Subroutine quit()
    stop
  End Subroutine quit

  Subroutine save()

  End Subroutine save

作者: fpchi9103    时间: 2018-10-22 15:00
谢谢回答,明白了




欢迎光临 Fortran Coder (http://bbs.fcode.cn/) Powered by Discuz! X3.2