Can't seem to add additional files to VS code to get them to compile in Torizon container

I have a Verdin iMX8MP plus module v1.1 and the Verdin dev board v1.1 using Visual Studio Code.
I have been able to compile and run in a container on the board, Hello World and the SPI test code. Both work correctly.
Now I want to add or replace the original SPI_Test.c with a file of existing code and compile it. However, I can’t seem to make it get past the prelaunchTask. I just get the following error:
Error executing preLaunchTask.

I have made no other changes, other than replacing the name of the file with a different one. The file is on my hard drive, but I don’t know if it is in the ${workspaceFolder}, in the container. I have the file open in an editor. Here is the output:

Torizon Extension Initialized
[02-01 22:20:25.255] LA_OPT_NXP_Software_License v5 January 2019 EULA accepted
[02-01 22:20:37.472] Toradex Verdin iMX8M Plus WB on Verdin Development Board(14762705) connected
[02-01 22:20:37.473] Torizon: all devices refreshed
[02-01 22:22:21.390] Preparing debug environment for C/C++ application…
[02-01 22:22:21.400] Running preLaunchTask build_debug…
[02-01 22:22:23.526] Error executing preLaunchTask.
[02-01 22:27:38.464] Preparing debug environment for C/C++ application…
[02-01 22:27:38.473] Running preLaunchTask build_debug…
[02-01 22:27:40.002] Error executing preLaunchTask.
[02-01 22:31:48.196] Preparing debug environment for C/C++ application…
[02-01 22:31:48.205] Running preLaunchTask build_debug…
[02-01 22:31:49.733] Error executing preLaunchTask.
[02-01 22:57:34.014] Preparing debug environment for C/C++ application…
[02-01 22:57:34.023] Running preLaunchTask build_debug…
[02-01 22:57:34.872] Error executing preLaunchTask.
[02-01 23:00:04.939] Preparing debug environment for C/C++ application…
[02-01 23:00:39.606] Preparing debug environment for C/C++ application…
[02-01 23:12:48.419] Preparing debug environment for C/C++ application…
[02-01 23:12:48.428] Running preLaunchTask build_debug…
[02-01 23:12:50.093] Error executing preLaunchTask.
[02-01 23:35:59.699] Preparing debug environment for C/C++ application…
[02-01 23:36:34.635] Preparing debug environment for C/C++ application…
[02-01 23:36:34.644] Running preLaunchTask build_debug…
[02-01 23:36:36.085] Error executing preLaunchTask.

Any help would be appreciated!

Steve

Hi @Evets ,

Make sure you’re using the latest versions of the C/C++ Microsoft extension and the Dev Containers extension, they recently got updated.

I have been able to compile and run in a container on the board, Hello World and the SPI test code. Both work correctly.
Now I want to add or replace the original SPI_Test.c with a file of existing code and compile it. However, I can’t seem to make it get past the prelaunchTask. I just get the following error:
Error executing preLaunchTask.

Given that the extension works with two different codes, the issue could be something related to your newer code or some of its compilation steps. Is your VSCode project a C/C++ Autotools/Makefile/CMake project? If that’s the case then I’d recommend double-checking your Makefile or equivalent to see if it needs additional flags or library references.

Best regards,
Lucas Akira

I am using the original setup (torizon create) for the project which is how you do the “Hello World!” project following the getting started website directions". I am unfamiliar with how it transfers to the target (other than I know it transfers over TCP/IP), and the local build has been disabled as per the Toradex website instructions. The problem is 2 fold for me, I’ve only used VScode briefly, in a couple of different environments, and it was mostly just testing things. No multi-file or any cross compiling.
The only thing I have changed other than adding files to the local directory, was to change the Task.json file to change the name of the file I am compiling.
I just set this up a few days ago and have used the “check for updates” function, so I am pretty sure I’m using the latest extensions and code.

Thanks!
Steve

Hi @Evets ,

I just set this up a few days ago and have used the “check for updates” function, so I am pretty sure I’m using the latest extensions and code.

That’s good to know.

I am using the original setup (torizon create) for the project which is how you do the “Hello World!” project following the getting started website directions".

Can you link the exact article you followed to create your project? When creating a C/C++ project in our extension (V1) it will always ask for a template e.g. CMake, Autotools, Single-file, etc. like indicated in the image below. All of them can be a “Hello World” project, so that’s why I asked.

vscode_extension_v1_cpp_projects

The only thing I have changed other than adding files to the local directory, was to change the Task.json file to change the name of the file I am compiling.

Can you post your tasks.json file with the changes? The build_debug task in preLaunchTask that is failing is defined in tasks.json as well, and it tries to compile your project. If this task in particular is not running successfully, then probably something is wrong with your compilation instructions. I’d recommend reading this article C/C++ Development and Debugging on TorizonCore Using Visual Studio Code | Toradex Developer Center for more details in C++ development with our extension.

Does your new code require additional libraries? Keep in mind that you should include any additional libraries in your compilation instructions.

Best regards,
Lucas Akira

I noticed you asked a question after the torizon: create that might be what caused the issue. The Hello World said to use the single file C++ application. This might be the issue. I am making one now that uses a makefile. This is more of what I know.

I’ll let you know if it works for me.

Steve

Yes, this worked using the makefile. However, now I have another issue. I have external repositories I need to have show up on my remote device. How do I get them there? Do I have to copy them manually, or is there a way to tell the system I need these files there?

Steve

hey @Evets,

Would you mind making making a separate ticket for the different issue? And include the specific setup you are wanting.

But to get you started you can look into how to modify the docker file of a container to include repositories that fit your need, and then use your method of uploading the new container to the remote device.

-Eric