运行多个源文件(简单)

来源:互联网 发布:dnf改版后光兵技能数据 编辑:程序博客网 时间:2024/06/09 17:00

源程序:

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 _printDebug/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.cprint.cLinking...helloword.exe - 0 error(s), 0 warning(s)
运行成功


0 0
原创粉丝点击