fortran和VC连编的问题,请指教!

common_man 2003-04-17 05:38:58
我在VISUAL FORTRAN中建了一个工程,其中有一个CPP文件,一个FOR文件,CPP文件如下:
#include <stdio.h>
#include <stdlib.h>
#include <afxwin.h>

#define IDEF int
#define FDEF float
#define CDEF char
#define PDEF int

void __stdcall MALLOF (PDEF *p,IDEF *bytes)
/* Allocate memory to pointer p. */
{
*p=(long)malloc(*bytes);
}
void __stdcall REALLF (PDEF *p,IDEF *bytes)
/* Adjust memory allocated to pointer p. */
{
*p=(long)realloc((void*)*p,*bytes);
}


编译错误如下:
Compiling...
mc.cpp
Linking...
LINK : warning LNK4098: defaultlib "libcd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
m.obj : error LNK2001: unresolved external symbol __wgsetactiveunit
m.obj : error LNK2001: unresolved external symbol __f_getwindowconfig@4
m.obj : error LNK2001: unresolved external symbol __f_setwindowconfig@4
m.obj : error LNK2001: unresolved external symbol _MALLOF@8
m.obj : error LNK2001: unresolved external symbol __initializefonts
m.obj : error LNK2001: unresolved external symbol __f_setfont@8
m.obj : error LNK2001: unresolved external symbol __f_moveto_w@12
m.obj : error LNK2001: unresolved external symbol __lineto_w
m.obj : error LNK2001: unresolved external symbol __f_outgtext@8
m.obj : error LNK2001: unresolved external symbol __setgtextrotation
m.obj : error LNK2001: unresolved external symbol __setwindow
m.obj : error LNK2001: unresolved external symbol __setviewport
m.obj : error LNK2001: unresolved external symbol __rectangle_w
m.obj : error LNK2001: unresolved external symbol __setcolor
m.obj : error LNK2001: unresolved external symbol __QWINSetExit
m.obj : error LNK2001: unresolved external symbol _REALLF@8
Debug/mc.exe : fatal error LNK1120: 16 unresolved externals
Error executing link.exe.

我实在是搞不定,老板催得又急,各位救救我吧!泣谢!
...全文
127 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
AkiraChing 2003-08-05
  • 打赏
  • 举报
回复
在msdn的地址栏中输入ms-help://MS.MSDNQTR.2003APR.1033/vccore/html/LNK4098.htm
可以帮你解决LNK4098的问题.
你可能要把这些函数放在
extern "C" {
...
你的函数
}
在C++中调用C函数没有使用extern "C"的话会出现LNK2001错误
lemonade 2003-08-05
  • 打赏
  • 举报
回复
up
common_man 2003-04-17
  • 打赏
  • 举报
回复
up
common_man 2003-04-17
  • 打赏
  • 举报
回复
up
common_man 2003-04-17
  • 打赏
  • 举报
回复
UP

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧