源程序:
Helloworld:
#include "print.h"
int main(void)
{
printHello();
return 0;
}
print.c:
#include "print.h"
void printHello()
{
print("hello word!\n");
}
print.h:
#include "stdio.h"
extern void printHello(void);
1、使用Visual C++6.0创建空的工程
2、在fileview窗口分别添加3个文件
3、编译报错
print.obj : error LNK2001: unresolved external symbol _print
Debug/helloword.exe : fatal error LNK1120: 1 unresolved externals
定位print.c文件的发现printf写错为print,修改后编译通过
Deleting intermediate files and output files for project 'helloword - Win32 Debug'.
--------------------Configuration: helloword - Win32 Debug--------------------
Compiling...
helloword.c
print.c
Linking...
helloword.exe - 0 error(s), 0 warning(s)
运行成功