fpchi9103 发表于 2018-10-18 15:21:34

SimplyFortran调用appGraphics问题

最近安装了simply Fortran,看见帮助文档里面有appGraphics,就想学学做界面,但是按照help文档里的例子做,却提示出错
程序:
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:53

明白了,那个“save”和“quit”是自己写的过程名。。。还以为是编译器已经给写好的。。。

vvt 发表于 2018-10-18 16:16:01

这俩函数需要你自己写。写俩空白的就好了。
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:44

谢谢回答,明白了:-hug:
页: [1]
查看完整版本: SimplyFortran调用appGraphics问题