在Windows上的Ubuntu上的Bash上的Eclipse C / C ++项目 [英] Eclipse C/C++ project on Bash on Ubuntu on Windows

查看:159
本文介绍了在Windows上的Ubuntu上的Bash上的Eclipse C / C ++项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我安装了Eclipse Neon(v4.6)。此外,我有在Windows上的Ubuntu的Bash(9月'16)。我安装了gcc和gdb进行编译和C语言调试。我在终端上测试了它们,它们正在运行。

I've installed Eclipse Neon (v4.6). Also, I have "Bash on Ubuntu on Windows" (Sept '16). I installed gcc and gdb for compiling and debugging in C. I tested them on terminal and they're running.

我试图用Eclipse创建一个新的C项目,但在编译器选择阶段,它没有给我选择使用Windows上的Ubuntu上的Bash编译器。

I'm trying to use Eclipse to create a new C project but in the compiler selection stage it doesnt give me the option to use the "Bash on Ubuntu on Windows" compiler.

有什么方法可以解决我的问题吗?

Is there any way to solve my problem?

推荐答案

我们使用Eclipse和一个makefile项目。我通过添加外部构建器来配置Eclipse,并使用以下脚本:

We use Eclipse and a makefile project. I configured Eclipse by adding an "external builder" - and use the following script:

-c "cd `echo '${project_loc}' | sed  -e 's/C:/\/mnt\/c/g' -e 's/\\\\/\//g'` && make -f path_to_makefile/makefile

cd sed 技巧是将EclipseC:\转换为Windows的Windows子系统 / mnt / c / 并将 \ 替换为 /

The "cd" and sed trick is to convert from Eclipse "C:\" to Windows Subsystem for Linux "/mnt/c/" and replace "\" with "/"

现在按照 $ {project_loc}

的定义执行Make项目想到如何在Linux上执行gdb,但至少编译+链接(并执行我的makefile中定义的单元测试)现在正在充分利用本地Ubuntu工具链的全部速度......

I still have not figured out how to execute gdb on Linux. But at least compile+link (and execute unit tests as defined in my makefile) is now leveraging the full speed of the native Ubuntu toolchain...

这篇关于在Windows上的Ubuntu上的Bash上的Eclipse C / C ++项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆