您的位置:首页 > 编程语言 > C语言/C++

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

2016-03-01 13:24 204 查看
分为两部分

第一部分 LIBproject 用来生成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文件夹里

第二部分 控制台project 用来调用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;

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: