C++使用没有工具链的 Eclipse?
我有一个必须在 Linux 上构建的 C++ 项目,但我没有设置运行任何类型 GUI 的 Linux 计算机(它们都没有监视器)。那么问题是,我可以使用 eclipse 通过文件共享进行开发并通过 SSH 进行构建吗?我一直在这样做,除了在 alt+tab
上进行大量磨损之外,唯一的问题似乎是自动完成功能无法正常工作。根据我收到的错误消息,我认为这是没有连接编译器或包含目录的结果。
有人有使用此类设置的经验吗?
人们似乎正在关注我的问题中的“如何使事情变得无缝”。我更感兴趣的是“如何让 Eclipse 的编辑功能发挥作用”。
所有提出的相当于“在 Linux 上进行开发”的解决方案都比问题更糟糕(问题主要是一个新生问题,如果我愿意,我可以解决它)
I have a C++ project that has to build on Linux but I don't have a Linux machine set up to run any kind of GUI (they all have no monitors). So the question is, can I use eclipse to develop via a file share and build via SSH? I've been doing this and aside from putting lots of wear on alt+tab
the only problem seems to be that auto-complete doesn't work right. Based on the error messages I'm getting, I think this is a result of not having either a compiler or include directory hooked up.
Does anyone have any experience working with this type of setup?
People seem to be looking at the "how to make things seamless" bit of my problem. What I'm more interested in is the "how to make Eclipse's editing stuff works as at all" bit.
All the proposed solutions that amount to "get set up to develop on Linux" are worse than the problem (the problem is mostly a nascence issue and I can work around it if I want to)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
难道没有可能使用XWindow或VNC在linux机器上进行开发吗?这样您就不需要额外的显示器。
Is there no possibility of using XWindow or VNC and develop on the linux machine? This way you don't need an extra display.
我有时在 Windows 中使用 Eclipse,并通过 SSH 在 Linux 机器中构建它。我必须编写一个makefile,然后将它们上传到linux机器并编译。
是的,自动完成功能实际上不起作用,未解决的问题包括……等等等等。要摆脱它,您应该在真正的 Linux 中使用 eclipse
,顺便说一句,为什么不尝试使用 cygwin/mingw 在 Windows 下编译您的项目。如果你不能,祝你好运,安装 Linux(遗憾的是,但这是提高代码性能的最佳方法)
I sometimes use eclipse in windows and build it in a Linux machine over SSH. I have to write a makefile, and then upload them to linux machine and compile.
Yes, auto-complete don't really work, unresolved include....blah blah. To get rid of it, you should use eclipse in a real Linux
and by the way, why not try cygwin/mingw to compile you project under windows. If you can't, good luck install Linux ( sadly, but it's the best way to improve you code performance )
我相信如果你足够聪明,你可以为 eclipse 编写一个插件来做到这一点。我认为如果没有一些编程或脚本,这是不可能的。如果您可以将其放在远程计算机上的 Samba 共享上,您可以让 Eclipse 生成 makefile,然后使用 ssh 远程登录到同一台计算机,然后只需运行 make 即可运行我相信 CDT 为您生成的 Makefile。如果您没有 mingw 或其他东西来欺骗 Eclipse 认为您想要使用 gcc 风格的编译器进行构建,我不确定 eclipse 是否会窒息。但是,尝试使用此设置进行调试时会遇到麻烦。学习如何编写自己的简单 makefile 可能会更好;或者在你的 Windows 机器上安装 cygwin 或 mingw 并在 eclipse 中使用 gcc 编译器。
I am sure if you are smart enough you could write a plugin for eclipse to do this. I don't believe that it's possible without some programming or scripting. If you can put it on a Samba share on the remote machine you could let Eclipse generate the makefile and then login in remotely to the same machine with ssh and then just run make to run the Makefile that I believe the CDT generates for you. I'm not sure that eclipse won't choke if you don't have mingw or something else on there to trick Eclipse into thinking you want to build with a gcc style compiler. However, you will have trouble trying to debug with this setup though. Probably better just to learn how to write your own simple makefiles; or install cygwin or mingw on your windows machine and use that gcc compiler with eclipse.
我正在使用 cpptasks 来 ant 在不同的目标平台(Windows 和 Linux)上构建项目。它使用平台编译器(例如 GCC 或 Visual Studio),但尝试(与 makefile 不同)使整个任务尽可能通用。因此,您可以在 Eclipse 中的计算机上的共享文件夹上进行开发,然后通过 SSH 在 Linux 远程端运行 ant 目标(当然它也可以让您设置正确的包含路径)。
I am using the cpptasks for ant to build a project on different target platforms (Windows and Linux). It uses the platforms compiler (e.g. GCC or the Visual Studio) but tries - unlike the makefile - to keep the whole task as generic as possible. So you can develop on your machine in eclipse on the shared folder and just run the ant target via SSH (it lets you of course set the correct include paths as well) on the Linux remote side.
VMWare 和 Linux 的本地副本。问题解决了。
或者 coLinux,您可以在 Windows 中运行 Linux。 andLinux 是一个使用 coLinux 内核的 Ubuntu 发行版。
VMWare and a local copy of linux. Problem solved.
Or coLinux, where you can run linux inside Windows. andLinux is a Ubuntu distro using a coLinux kernel.
我不确定这是否仍然是一个问题,刚刚遇到过这个。
如果您的目的只是获得 Eclipse IDE 的自动完成优势,而不是其他功能(如远程调试等),那么您应该可以使用您所说的共享磁盘方式。
自动完成功能可能会因为编译器缺少系统包含而陷入困境——您可能只是从目标系统中取出这些文件(Linux 上是 gcc 吗?或者只是从 gcc 源 tar 球中取出它)并将它们放在您的 eclipse 可以的地方拿起它们,相应地调整包含路径。
显然,您正在考虑在目标机器上进行编译/构建。如果您使用纯 C++ 进行编码,则可以使用本地 C++ 编译器在 eclipse 下对其进行测试,尽管 make 文件可能有所不同,但大多数情况下只是编译器/链接器选项。
祝你好运!
I'm not sure if that's still an issue, just came across this.
If your intent is just to reap the auto-complete benefit of eclipse IDE and not other features (like remote debugging etc), then you should be fine just with the shared disk way as you stated.
The autocomplete probaly stumbles on the lack of system includes from the compiler -- these you may just lift off your target system (is it gcc on your Linux? or just get it off the gcc source tar ball) and put them where your eclipse could pick them up, adjust the include path accordingly.
Obviously, you're looking at compiling/building at your target machine. If you code in plain C++, you may test it under eclipse with your local C++ compiler, though the make files might be somewhat different, but mostly it's just compiler/linker options.
Good luck!
虽然我没有这种确切配置的经验,但您的问题似乎需要 构建服务器。尝试 TeamCity,它具有Linux 版本是一个很棒的产品。您可以无限期地使用有限数量的用户/构建配置来评估它。
还有CruiseControl,它的功能不那么丰富,但它是免费的(啤酒+语音)。
While I don't have experience with this exact configuration, your problem seems to call for a build server. Try TeamCity, which has a Linux version and is a great product. You can evaluate it with a limited number of users/build configurations indefinitely.
There's also CruiseControl, which is not as feature-rich, but it's free (beer + speech).