主题:请教VC调用fortran的实现
zqb138
[专家分:160] 发布于 2011-11-23 23:02:00
我用VC建立了基于一个对话框界面的工程,同时也有一个fortran源程序。想实现在对话框界面中调用这个fortran程序。网上见到的要么是c++的控制台程序调用fortran的,要么就是VC调用fortran的DLL的。是否有把这个界面工程包含fortran程序直接进行编译的方法?
回复列表 (共18个回复)
11 楼
cgl_lgs [专家分:21040] 发布于 2011-11-24 21:12:00
# Microsoft Developer Studio Project File - Name="cfd" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Application" 0x0101
CFG=cfd - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "cfd.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "cfd.mak" CFG="cfd - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "cfd - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "cfd - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
F90=df.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "cfd - Win32 Release"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 5
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE F90 /compile_only /nologo /warn:nofileopt /winapp
# ADD F90 /architecture:pn4 /assume:buffered_io /assume:byterecl /compile_only /math_library:fast /nologo /threads /warn:nofileopt /winapp /fast
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
# ADD CPP /nologo /G6 /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /Yu"stdafx.h" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
# ADD RSC /l 0x804 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
# ADD LINK32 /nologo /subsystem:windows /machine:I386
!ELSEIF "$(CFG)" == "cfd - Win32 Debug"
# PROP BASE Use_MFC 6
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 6
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE F90 /check:bounds /compile_only /dbglibs /debug:full /nologo /traceback /warn:argument_checking /warn:nofileopt /winapp
# ADD F90 /check:arg_temp_created /check:bounds /check:format /check:power /check:output_conversion /check:overflow /check:underflow /compile_only /dbglibs /debug:full /libs:dll /nologo /threads /traceback /tune:pn4 /warn:argument_checking /warn:declarations /warn:noignore_loc /warn:truncated_source /warn:unused /winapp
# SUBTRACT F90 /warn:ignore_loc /warn:nofileopt
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
# ADD CPP /nologo /G6 /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
!ENDIF
12 楼
zqb138 [专家分:160] 发布于 2011-11-24 21:30:00
不好意思,我把上述内容替换原来dsp文件的内容后工程面目全非了,对话框也没有了。
13 楼
cgl_lgs [专家分:21040] 发布于 2011-11-24 22:17:00
敢向毛主席保证你贴的是不全的,
所以我也没法儿给你贴全了:)
注意合并:)
14 楼
cgl_lgs [专家分:21040] 发布于 2011-11-24 22:18:00
我晕,你直接替换了?
我都说了你没贴全,所以我也没法儿贴全~~~~
15 楼
zqb138 [专家分:160] 发布于 2011-11-25 08:45:00
替换合并之后编译还是同样的errors和warnings。
16 楼
cgl_lgs [专家分:21040] 发布于 2011-11-25 09:33:00
那Release版本呢?
17 楼
zqb138 [专家分:160] 发布于 2011-11-25 16:29:00
本人计算机水平太低,呵呵,你还是告诉我设置的方法吧?
18 楼
cgl_lgs [专家分:21040] 发布于 2011-11-25 20:57:00
要是楼主放心,还是把工程打包发给我吧,我仔细看看怎么回事儿,理论上来说应该我这样设置就行了的。
我来回复