使用Vs2015开发linux(centos7)程序

本文介绍如何使用VS2015进行跨平台开发及远程调试,包括安装必要的开发工具、配置VS2015进行Linux项目的创建与调试等步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.首先下载vs2015 with update3

2.然后下载Visual C++ for Linux Development

https://visualstudiogallery.msdn.microsoft.com/725025cf-7067-45c2-8d01-1e0fd359ae6e

Ps:另一篇文章介绍这个:(https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/

3.在centos 7上yum install openssh-server gdb gcc-g++

4.下载安装gdbserver,在:https://pkgs.org/centos-6/centos-x86_64/gdb-gdbserver-7.2-90.el6.x86_64.rpm/download/下载

Rpm下载地址:http://mirror.centos.org/centos/6/os/x86_64/Packages/gdb-gdbserver-7.2-90.el6.x86_64.rpm

然后rpm –i gdb-gdbserver-7.2-90.el6.x86_64.rpm

安装

5.在vs2015中

新建->项目->empty project(linux)


然后新建一个cpp文件(注意文件名为英文)

6.工具->选项->cross platform->connection manager

 

点add


填写centos的ip,用户名,密码

7.在项目名上右键,调出属性窗口,在target machine上选择你的目标主机


8.填写调试参数


9.写个代码来试试:

[cpp]  view plain  copy
 print ?
  1. #include<iostream>  
  2. using namespace std;  
  3. int ab()  
  4. {  
  5.     for (int i = 0;i < 10;i++)  
  6.     {  
  7.         cout << i << endl;  
  8.     }  
  9. }  
  10. int main()  
  11. {  
  12.     int a = 1;  
  13.     cout << "hello" << a << endl;  
  14.     ab();  
  15.     return 0;  
  16. }  



在centos 中也有生成,这样就成功了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

sunxiaopengsun

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值