本人刚学Fortran,因化工类一些课题需要模拟计算
[问题1]:
看了《彭国伦》经典教程
其中书本光碟自带SGL库在我的计算机上无法加载(已将Lib和include装进去对应文件夹了),
运行如下代码:
[Fortran] 纯文本查看 复制代码 program main
use sgl
implicit none
external display ! 声明display是个函数
! 设定当窗口需要重绘时,会调用子程序display
call sglDisplaySub(display)
! 打开窗口, 窗口左上角为(100,100), 长宽同为500
call sglCreateWindow(100,100,500,500,0)
write(*,*) "Waiting message."
! 等待使用者给程序的信息
call sglMainLoop()
write(*,*) "The End."
stop
end
! 每当窗口需要更新画面时, 会调用display
subroutine display()
use sgl
implicit none
call sglClearBuffer() ! 消除屏幕
call sglColor3f(1.0,0.0,0.0) ! 设定目前要使用红色来绘图
call sglDrawLine(0,0, 500,500) ! 在(0,0)到(500,500)两点之间画线
return
end subroutine
--------------------Configuration: 20150608 - Win32 Debug--------------------
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\20150608\01.f90
Linking...
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
01.obj : error LNK2001: unresolved external symbol _SGLDRAWLINE@16
sgl.lib(sglcore.obj) : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__PostQuitMessage@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__SetWindowTextA@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__ShowCursor@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__SetTimer@16
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__KillTimer@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__DispatchMessageA@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__TranslateMessage@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__PeekMessageA@20
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__SendMessageA@16
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__UpdateWindow@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__ShowWindow@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__RegisterClassA@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__GetStockObject@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__LoadCursorA@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__GetSystemMetrics@4
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__DefWindowProcA@16
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__EndPaint@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__BeginPaint@8
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__AdjustWindowRect@12
sgl.lib(sglwin32.obj) : error LNK2001: unresolved external symbol __imp__SetRect@20
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__CreateFontA@56
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__DeleteObject@4
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__ReleaseDC@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__GetDeviceCaps@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__GetDC@4
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__GetClientRect@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__TextOutA@20
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__SetTextColor@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__SetBkMode@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__SelectObject@8
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__OffsetRect@12
sgl.lib(ddraw_utility.obj) : error LNK2001: unresolved external symbol __imp__ClientToScreen@8
Debug/20150608.exe : fatal error LNK1120: 34 unresolved externals
Error executing link.exe.
20150608.exe - 36 error(s), 1 warning(s)
百度了,貌似很多人遇到这个问题,但都不知道怎么具体解决哦
有的说在project-setting-Link再加入什么参数???
本文系统:Win8,安了IVF2013后,又安装过兼容模式的CVF 6.6,都遇到这样问题唉,目前因为自学需要都用CVF 6.6
请高手解答一下;
[问题2] 想问下,MSFLIB这个是什么库???哪里有的下载?有的代码有应用这个库,希望看看运行效果
谢谢
|