首页 > 编程语言 > 详细

初次接触VC++加载自定义LIB 即静态链接

时间:2015-06-06 18:10:26      阅读:110      评论:0      收藏:0      [点我收藏+]

分为两部分

第一部分  LIB工程 用来生成LIB文件

#ifndef _myfun
#define _myfun
int myfun(int x,int y)

{

return x+y;

}
#endif


将lib文件放在Visual Studio\VC98\Lib目录里

将myfun.h移到Visual Studio\VC98\Include目录里


第二部分 控制台工程 用来调用LIB中的函数

#include "stdafx.h"
#include <myfun.h>
#include <iostream>
#include <conio.h>
using namespace std;


extern int myfun(int,int);


int _tmain(int argc, _TCHAR* argv[])
{
cout<<myfun(3,4)<<endl;
_getch();
return 0;
}




初次接触VC++加载自定义LIB 即静态链接

原文:http://blog.csdn.net/mfmfmmf1/article/details/46390313

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!