win10调试linux

参考
https://blog.csdn.net/mumufan05/article/details/80094637
https://blog.csdn.net/u013272009/article/details/81023594

我的步骤:
1.下载https://github.com/robotdad/vclinux
2.将其拷贝到Linux解压
3.为自己的代码写一个makefile,在网上找的通用模板,根据自己的编译选项稍作了修改

#############################################################

## 简洁通用的Makefile文件(Ver 1.1)
## Smart Makefile for general purpose (Ver 1.1)
## Author: 汤 永康 Yongkang TANG <tangyk%at%gmail>
## License: FreeBSD 
## Please use this makefile at YOUR OWN RISK !!!
## Source: https://github.com/tangyk/Smart-Makefile
## 功能: (1)自动搜索编译指定目录下的所有c/c++程序文件
##	  (2)自动搜索并包含(#include)指定目录下的头文件
##	   (3) 可一次性生成多个可执行文件
##	  (4) 设置简单	
##
##  用法:  make   编译所有的应用程序
##          make [step4指定的某程序名]
##          make clean  清除obj文件
#############################################################
CC=g++

# Step1.设置第三方头文件的路径以及编辑参数.  比如 CFLAGS= -c -Wall -g -I/any/path/inlude
CFLAGS= -c -Wall -g -std=c++11

# Step2.设置库文件以及库文件路径 比如 LIBS = -lGL -lGLU `pkg-config --libs opencv`
LIBS=  -lpthread

# Step3.制定程序的所在路径
# 路径不能以 [/] 符号结尾.  应设置为:  SRC_DIR = . , SRC_DIR = ./test1 
SRC_DIR = .

# Step4.需要生成的可执行程序列表 e.g. APP = app1 app2 app3
APP = threadPool

#app_EXCL = ./test2/src/test3.cpp ./test2.cxx
# Step5.一个可执行程序只能有一个(main)入口。
# 当有多个应用程序时,需要设置生成各个可执行程序时,需要排除的程序文件列表
# 如果step4中指定的应用程序是server, 在生成server时,需要排除 ./client.c 以及 ./test1.c的话,应做如下设置
#server_EXCL = ./client.c ./test1.c 
# 以此类推。

########################### 请不要更改以下内容 ##########
EXTS := *.C *.c *.cxx *.CXX *.cpp *.CPP *.cc *.CC
DIRS := ${shell find ${SRC_DIR} -type d -print}
SRCS := $(foreach dir,$(DIRS),$(wildcard $(addprefix $(dir)/,$(EXTS))))
CFLAGS += $(foreach dir,$(DIRS), $(addprefix -I,$(dir)))
OBJS := $(addsuffix .o, $(SRCS))

define CMPL_APP
$(1): $(filter-out $(addsuffix .o,$(value $(1)_EXCL)), $(OBJS))
	$(CC) -o $(1) $(filter-out $(addsuffix .o, $(value $(addsuffix _EXCL, $(1)))), $(OBJS)) $(LIBS) $(value $(addsuffix _LIBS, $(1)))
endef

define CMPL_SRC
${1}.o:
	${CC} $(CFLAGS) ${1} -o ${1}.o
endef

.PHONY: all clean
.SUFFIXES:

all: $(APP)
	
$(foreach s,$(SRCS),$(eval $(call CMPL_SRC, $(s))))
$(foreach ap,$(APP),$(eval $(call CMPL_APP, $(ap))))

clean:
	rm -f ${OBJS} ${value APP}

4.在linux上build vs 工程


cd /root/Desktop/vclinux-master/bash
./genvcxproj.sh /root/Desktop/codesForPractice/threadPool/mythreadPool (工程目录) mythreadPool.vcxproj
./genfilters.sh /root/Desktop/codesForPractice/threadPool/mythreadPool (工程目录)
mythreadPool.filters

5.将工程目录/root/Desktop/codesForPractice/threadPool/mythreadPool拷到win10
6.用vs打开mythreadPool.vcxproj
7.配置该工程的调试属性

程序 /root/Desktop/codesForPractice/threadPool/mythreadPool/threadPool (工程目录下的可执行文件)
工作目录 /root/Desktop/codesForPractice/threadPool/mythreadPool/(工程目录)
调试模式 gdb
调试子进程 否

在这里插入图片描述
注意调试时应选x64.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值