Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Monday, December 4, 2023

Sharing files between Windows and Ubuntu virtual machine

I have a Windows 10 PC with Ubuntu 22.04 installed as a VirtualBox virtual machine. There are other ways to share files between Windows and Ubuntu, but the following is the most general way I know:

  1. On Windows, share a folder (e.g. "temp") with your own windows user name.
  2. Find the IP address of VirtualBox ethernet adapter:

  3. On Ubuntu make sure you can ping that IP address.
  4. Open a new Files window, at the bottom left, click on other locations. Then, at the bottom enter smb://<VirtualbBox ethernet adapter IP address>/<Windows folder name>

  5. After clicking Connect button, you should see the temp folder:

Installing Eclipse CDT and build-essentials to offline Ubuntu

On my offline Ubuntu I use Eclipse C++ (CDT) and build-essentials to build C++ projects. To install Eclipse C++ (CDT) and build-essentials to offline Ubuntu:
  1. Download Linux version of Eclipse C++, copy to offline Ubuntu and extract. You can directly run eclipse without any further installation, but you need to finish the following steps to build a C++ project.
  2. On your Windows PC that is connected to the internet, install a virtualizer like VirtualBox  and install Ubuntu Desktop 22.04 as virtual machine.
  3. Enable Windows - Ubuntu file sharing.
  4. Use the following shell script to download build_essentials on your online PCs Ubuntu virtual machine and its dependencies. You can copy these downloads to your offline Ubuntu and install them following the steps written as comments down below:

Monday, January 10, 2022

Eclipse working folder

To change Eclipse working folder so that file paths are the same when running project from IDE and when running the binary from terminal, you have to set the working directory (similar to Visual Studio) using the Run Configurations - Arguments - Working Directory: ${workspace_loc:MyProject/Debug}

Note that Eclipse run configurations are saved in <eclipse-workspace>.metadata/.plugins/org.eclipse.debug.core/.launches

To copy files on Linux Eclipse in post-build step:

  1. Select Project - Properties - C/C++ Build - Settings - Build Steps
  2. In Post-build steps, enter cp source destination
If you have changed the working folder as explained above, then source will be relative to that working folder. If, for example, you want to copy a folder to working folder, you could use cp -f -R ../src/config .
You can enter more than one cp command by separating them with a semicolon (;)