[SOLVED] Can I code in the same project folder form Linux and Windows?

I am running PlatformIO in VScode on Windows; all works well.

Now I have this idea of migrating to Linux, installed VScode and PlatformIO and was wondering, whether I can code my projects in the same project folder, I worked on in Windows?
I have a SSD I share between the two operating systems.
As one can guess the paths to files are different.
In my case Windows D:\Data\... is in Linux /media/maxg/Data SSD/Data/...
Indicating to me that libraries and compil paths are different between the systems.

Has anyone found a solution to this problem?
Or is there a way of achieving this?

Do you use dual boot or these are different physical machines?
Itā€™s possible to run Visual Studio Code remotely, so that you connect from one machine to another. All projects and libraries are stored remotely, the project is built on the remote machine too. See Visual Studio Code Remote Development

I dual boot between Windows and Linux, and share two hard drives between both of them, one which has my PlatformIO/Arduino/etc project on it. I donā€™t have any path issues, as I donā€™t hard-code any paths into the platformio.ini or any extra_scripts that I might need. The only issue you might encounter is options like upload_port requiring a different reference, so in that case I usually have both listed, and comment out that invalid one.

Interestingā€¦ :slight_smile:
In my case it is a dual boot config.

Yes, same hereā€¦
I did not hard-code any paths, however, I see things like this:
image
ā€¦ despite having installed PubSubClient and Ethernet libraries.

My install went as follows:
download VScode
apt install
selected PIO extension
installed PubSubClient, Ethernetā€¦
opened the project folder on the shared drive
loaded the WaterLevel main.cpp
And this is where I am now.
Lost.

I would expect that when I have a clean install and open a .cpp file that at elast the installed libraries would not be indicated as ā€˜cannot open sourceā€™.

What if you clean your .vscode subfolder of your project?

1 Like

I sometimes have the same problem, but it usually goes away after I close the folder, and re-add it to VSCode. This is after I have run through a build, so that all the necessary toolchains and framework files are installed, as until thatā€™s doneā€¦ those warnings from IntelliSense are indeed correct because any missing tools/framework files will be installed when you try to build / upload.

Also, when you look at your .vscode\c_cpp_properties.json file, you may notice it has Win32 and linux paths in it, or just the paths that relate to the last OS you were on. Deleting that file, and re-adding the folder to VSCode may also fix up IntelliSense as it will force a full update. Once itā€™s working, it usually behaves from then onwardsā€¦ only occasionally do I have to poke something to make it work properly :wink:

1 Like

Well, had I opened the workspace instead of the folder, all woul dhave been sweet; as in working; duh!

Thank you for staying with me! Much appreciated. All good now.

1 Like