Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build a c++ project on a remote computer in Eclipse?

I have a Windows pc with Eclipse Ganymede installed, and a Linux pc where my C++ project files are located. I use Eclipse to edit the files through SMB, and would like to build the project using Eclipse as well. Currently I connect using putty to my linux machine, and run ./make from the appropriate directory. How would I run the same command within Eclipse and see the results in it? I have installed the RSE plugin, but still can't grasp how to do so.

Just to made myself clear - I can use VNC to work on Eclipse that is installed on my linux machine, but I prefer not do so. Eclipse through VNC is slow and not as responsive as the Eclipse installed on my windows machine.

Thanks, Rouli

like image 334
r0u1i Avatar asked May 13 '09 06:05

r0u1i


People also ask

How do I remotely access my Eclipse?

To connect to the remote via the SSH connection type Only server, go to "Server Name -> SFTP Files -> Root". Eclipse will then ask you for a user name and password to connect to the remote server.

How do I open an existing C project in Eclipse?

Open the Import Wizard Dialog by selecting File > Import... or activate a context menu on a C/C++ project and select Import.... Select C/C++ > C/C++ Project Settings. Click Next.

Does Eclipse support SSH?

Remote System Explorer is result of Eclipse Target Management team work. It support SSH, Telnet, FTP and DStore protocols.


2 Answers

I was in a similar situation, developing in a windows workstation, compiling in a linux server. This is what I ended doing:

  1. Setup a passwordless login to the compiler server with putty, for example you can follow this tutorial.
  2. Create a login session with putty, make sure that in Connections/SSH/Auth is pointing to your private key.
  3. Modify eclipse make command to plink.exe -load "saved_session" make -C /remote/path/project (This setting is in Project/Properties/C++Build/Builder Settings/Build command). You can automate this with a batch/shell file if you have to pass more parameters and/or your setup is more complex.

If you have stored a passphrase with your private key then you can use pageant.exe to load your key only once, so you dont have to type your passphrase every time.

like image 138
Ismael Avatar answered Sep 21 '22 15:09

Ismael


You can create a project on a remote machine using RSE. To do so you must have the RSE server component installed on the remote machine. Create a connection to the machine using the RSE Remote Systems view. Create a new C/C++ project and on the first page of the wizard uncheck the checkbox that says "use default location". This enables a dropdown of file system providers, choose RSE. Then when you click Browse you will get a dialog that lets you browse the remote system for the folder where you want your project to live.

There are a few issues with this approach. First of all when the CDT indexer wants to build the index it needs to parse all the files in your project, which means downloading all the files to your local machine. This can be slow if you have a large project or a slow connection.

Another issue is that when you restart eclipse the remote projects will be closed. This is because you don't have a connection to the remote machine yet so eclipse can't read the .project file. You will have to reopen your remote projects every time you start eclipse.

There is currently a project in the works called RDT (Remote Development Tools) which adds remote indexing capabilities to CDT. That means the indexer will live on the remote machine with your code, so the files don't have to be downloaded for the indexer. Its still in "alpha" status, but if you are adventurous and want to try it out go here.

like image 45
Mike Kucera Avatar answered Sep 19 '22 15:09

Mike Kucera