Table of Contents
Using WinSCP to Edit Files on Windows and Compile on Linux
Overview
- The user connects to the remote machine via WinSCP.
- Using an editor on a windows system, the user changes files, which are automatically transferred to a remote machine.
- Using an terminal open on the remote machine (PuTTY), the user compiles and executes the code.
Discussion
WinSCP is a file transfer client for windows. It has a nice graphical user interface and is a good choice for transferring files between windows and linux.
This client can be configured to provide a simple yet powerful graphics environment when editing on windows and compiling on a remote linux machine.
WinSCP has the option of using a built-editor or an editor that has been installed on the windows computer. It has notepad configured for this option by default. Unfortunately neither of these are particularly well suited for coding. It is relatively easy to configure WinSCP to use any editor installed on the windows computer.
A minor change needs to be made to WinSCP to prevent this software from changing the timestamp on the remote machine, thus confusing the make system.
Configuration Steps
Configuring an Alternative Editor for WinSCP
In order to perform this procedure, you should have an alternative text editor installed on your windows computer. This example will show how to configure WinSCP to use Notepad++. The example assumes that Notepad++ is already installed.
- Connect to the remote machine with WinSCP.
- Right click on any text file and select *Edit* → *Configure …*
- Select the *Add* option to add a new editor.
- Select *External Editor:* and browse to your editor of choice.
- If you are unsure of the location of your editor you can:
- Right click on the editor icon on the desktop and select *Preferences *
- Note the path to the executable in the *Target* box
- Be sure to browse to the path as WinSCP adds other values at the end of the path.
- Click *OK* and finish
- If you want this become the default editor, use the *Up* button to move the new entry to the top of the list.
Disabling Timestamp Preservation in WinSCP
At the time of writing the default configuration for WinSCP attempts to preserve the time stamp for files transferred. This behavior will cause a problem for tools such as make as it will set the timestamp for the file incorrectly.
Note that the time for the file main.cpp is only the date, not the date and time. Also notice that make flags this as an error.
To correct this problem:
- In the WinSCP application
- Select the Dropdown menu for *Transfer Settings*/
- Select *Default* and click on *Edit*
- Disable *Preserve timestamp* in the *Common Options* area
- Click *OK* to close each window.
Note the time is now included for the file main.cpp and make no longer reports an error.