国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

Visual Stuido (1): 跨項目調(diào)用 同一個solution下面不同project之間的方法調(diào)用

2019-11-11 05:10:32
字體:
供稿:網(wǎng)友

因為本人自己需要在同一個solution下面做多個PRoject,我用的是VS2015, 語言C++。 首先創(chuàng)建兩個project,其中HelloMultiproject作為啟動的project,它是exe類型;AnotherProject是dll類型的,如圖: 這里寫圖片描述

有兩種方式來從一個project調(diào)用另一個project的方法(或者類)。

1. 如果AnotherProject的配置Configuration Type是Dynamic Library(.dll)

使用dllexportdllimport AnotherProject的配置: 這里寫圖片描述 HelloMultiProject不需要配置。

// Another project//FindMax.h#pragma once#include "stdafx.h"_declspec(dllexport) int findMax(int i, int j);//FindMax.cpp#include "stdafx.h"#include "FindMax.h"int findMax(int i, int j){ return i > j ? i : j;}// HelloMultiProject// HelloMultiProject.cpp : Defines the entry point for the console application.//#include "stdafx.h"_declspec(dllimport) int findMax(int i, int j);int main(){ findMax(1, 2); return 0;}

2. 如果AnotherProject的配置Configuration Type是Static Library(.lib)

AnotherProject的配置: 這里寫圖片描述

HelloMultiProject的配置: 這里寫圖片描述

// Another project//FindMax.h#pragma once#include "stdafx.h"int findMax(int i, int j);//FindMax.cpp#include "stdafx.h"#include "FindMax.h"int findMax(int i, int j){ return i > j ? i : j;}// HelloMultiProject// HelloMultiProject.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "FindMax.h"int main(){ findMax(1, 2); return 0;}
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 射阳县| 油尖旺区| 齐齐哈尔市| 乌拉特中旗| 南部县| 洛扎县| 安溪县| 金乡县| 凤山县| 自治县| 彭泽县| 迁安市| 申扎县| 岳普湖县| 祁东县| 柘荣县| 什邡市| 东乌珠穆沁旗| 西平县| 通州市| 陕西省| 肥东县| 白水县| 莱西市| 金湖县| 凤庆县| 都江堰市| 泸水县| 讷河市| 鄂州市| 晋江市| 黄大仙区| 洞头县| 双柏县| 蒙自县| 嘉禾县| 永新县| 乌兰浩特市| 武邑县| 汤原县| 青铜峡市|