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:
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.
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.
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.
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.
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.
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?
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.