初次接触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;
}
第一部分 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;
}
相关文章推荐
- C语言的编译器及编译过程
- 跨平台C++服务器程序开发 (1)了解跨平台开发
- Sublime Text3 C++及Java开发环境配置
- 【C++11】30分钟了解C++11新特性
- c++ 获取外网ip地址
- C++之pair(粘的别人的帖子)
- C语言之memcpy函数
- GeekBand学习笔记:C++三大函数:拷贝构造、拷贝赋值、析构函数
- C语言的宏定义
- C++第一次上机报告
- C++ template —— 函数对象和回调(十四)
- 第一次c++
- C++实验1-计算两个数的和与差
- c++项目试验(一)——求两数的和与差
- C++第一次上机实验项目2----计算两个整数的和及差
- c++作业1
- C++上机报告(示例)
- 第一次项目二-1c++上机报告
- C++ Super-FAQ 『Operator Overloading』
- C++ Super-FAQ 『Assignment Operators』