Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 8 Replies) Remote Linux login error (Solved: Not using valid Arduino project structure) (Read 2283 times)
Lee Critchlow
Junior Member
**
Offline


Posts: 26
Location: TN
Joined: Jul 19th, 2022
Remote Linux login error (Solved: Not using valid Arduino project structure)
Aug 8th, 2023 at 5:57pm
Print Post  
I have an Arduino c/c++ program that I have revised files with multiple classes into a separate file for each class. In addition, I've renamed using a prefix for each file. When I try to compile I get a remote Linux login. I've installed WSL, however, when I try to login there is a red box around Host name and port. I've also tried 23 in place of 22 (found article in Stack Overflow). How do I find the correct port number? Why is it not recognizing the VM name? Using VS2022.
« Last Edit: Aug 9th, 2023 at 12:38am by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2707
Joined: Feb 13th, 2019
Re: Remote Linux login error
Reply #1 - Aug 8th, 2023 at 6:07pm
Print Post  
If your project should be compiled with Visual Micro this should not be needed at all.  We only use the Linux Tools in the newer versions to power the Intellisense Engine, but not the build system in any way.

Did you create your project from one of our templates, or the File > New Arduino Project option?

Do you see the vMicro > Build button?
  
Back to top
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 26
Location: TN
Joined: Jul 19th, 2022
Re: Remote Linux login error
Reply #2 - Aug 8th, 2023 at 7:47pm
Print Post  
I keep all of my Visual Studio projects on a separate drive to keep the VS clutter off the C drive. Then use BC4 to update the Documents\Library\project when using the Arduino IDE to compile.
When I create a new project with vMicro, the menus are present and the project was created in Documents\Library\'project'.
When I move the project to my VS drive, update the solution file, the vMicro menu are not present and will not show. 
Does vMicro only work with Documents\Library? 
I just switched the visibility to 'Manual All', menus are visible,  however, the build button is gray. ???
« Last Edit: Aug 8th, 2023 at 7:57pm by Lee Critchlow »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Remote Linux login error
Reply #3 - Aug 8th, 2023 at 7:58pm
Print Post  
It does not matter where the project is. It sounds like you have rename the master .ino file but the project name and/or folder name do not match.

For Arduino the master .ino name must match the folder name. It is the same for Visual Micro but the VS project name must also have the same name.

Matching the name of an .ino, the name of the folder and the name of the project will let Visual Micro know that it can manage the project.
« Last Edit: Aug 8th, 2023 at 7:59pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 26
Location: TN
Joined: Jul 19th, 2022
Re: Remote Linux login error
Reply #4 - Aug 8th, 2023 at 8:12pm
Print Post  
I keep all solutions in a 'board type' folder. The solution name is the project name with a prefix of 'sln_'. The 'Solution' folder contains the project folder, .vs folder, the .sln file, and the .sln.DotSettings.user file. The 'Project' folder contains the .vcxproj file, the .vcxproj.filters file, the .vcxproj.user file, an __vm folder, a bin folder, an obj folder, and an scr folder. The scr folder contains the  .h, .c, .hpp, .cpp files, and a folder with the 'Project' name which contains the 'Project'.ino file.
The only item that does not match is the solution name.  Cry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Remote Linux login error
Reply #5 - Aug 8th, 2023 at 8:28pm
Print Post  
The name of the solution is not important. Multiple solutions can contain the same project. 

Th bin and object folders have been created by VS because Visual Micro is not managing the project.

The [ProjectName].ino file must be in the project folder.  The arduino ide would not be able to compile the code with the .ino in "ProjectName\src\ProjectName\ProjectName.ino"

If you use the menus to create a new Visual Micro project it will show the correct structure. Close you current solution before doing so to see the best example.

You might use something like this

SolutionFolder
SolutionFolder\MySolution.sln
SolutionFolder\Projects\ProjectName
SolutionFolder\Projects\ProjectName\ProjectName.ino
SolutionFolder\Projects\ProjectName\src\foo.cpp
SolutionFolder\Projects\ProjectName\src\foo.h

That would mean the ProjectNam folder is the project and the Arduino IDE would be happy opening a sketch from the ProjectName folder.

The solution can be located anywhere but the above structure works well for source control by keeping everything below a root solution directory.

The rules ensure compatibility with the Arduino IDE which can only recognise a valid sketch project by directory name and .ino name. The ProjectName\src sub folder is also part of the Arduino documented standard. the Arduino standard also specifies there can be any number of sub folders below the \src folder.
« Last Edit: Aug 8th, 2023 at 8:30pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 26
Location: TN
Joined: Jul 19th, 2022
Re: Remote Linux login error
Reply #6 - Aug 8th, 2023 at 10:47pm
Print Post  
Starting over.
VS2022(without code)->vMicro->New Arduino project->GrblMega-2023_08_08.
Created in  Documents\Arduino, however, not in Documents\Arduino\Library\ as GrblMega_2023_08_08 (note - changed to _).
VS2022->renamed solution from GrblMega_2023_08_08 to sln_GrblMega-2023_08_08, project from GrblMega_2023_08_08 to GrblMega-2023_08_08, GrblMega_2023_08_08.ino to GrblMega-2023_08_08.ino. Deleted .GrblMega_2023_08_08.vsarduino.h, left behind .GrblMega-2023_08_08.vsarduino.h.
Renamed Documents\Arduino\GrblMega-2023_08_08 folder to sln_GrblMega-2023_08_08, sub folder GrblMega_2023_08_08 to GrblMega-2023_08_08, changed sub folder GrblMega_2023_08_08 items to GrblMega-2023_08_08.
Edited sln_GrblMega-2023_08_08.sln-> changed GrblMega_2023_08_08 items to GrblMega-2023_08_08.
Documents\Arduino\sln_GrblMega-2023_08_08\GrblMega-2023_08_08-> __vm, bin, obj, src, GrblMega-2023_08_08.ino, GrblMega-2023_08_08.vcxproj, GrblMega-2023_08_08.vcxproj.filters.
Cut Documents\Arduino\sln_GrblMega-2023_08_08 folder, pasted to VisualStudio\GrblMega\
Using GrblMega-2023_08_08.vcxproj into VS2022.
Renamed solution from GrblMega-2023_08_08 to and saved .sln to VisualStudio\GrblMega\sln_GrblMega-2023_08_08 folder.
Using BC4, copied saved src files to this project src.
Right click the project-> click Add-> click Existing item-> selected src items.
Right click the project-> click Add-> click Existing item, navigated to src\GrblMega-2023_08_08 folder-> selected GrblMega-2023_08_03.ino.
Project now has header file, source files, and GrblMega-2023_08_03.ino.
vMicro build button is gray. Undecided

sln_GrblMega-2023_08_08 folder
sln_GrblMega-2023_08_08\sln_GrblMega-2023_08_08.sln
sln_GrblMega-2023_08_08\GrblMega-2023_08_08 folder
sln_GrblMega-2023_08_08\GrblMega-2023_08_08\GrblMega-2023_08_03.ino (missing-> copied from src\GrblMega-2023_08_08 folder)
sln_GrblMega-2023_08_08\GrblMega-2023_08_08\src\ .c, .h, .cpp, .hpp

.GrblMega-2023_08_08.vsarduino.h contains #include "..\GrblMega-2023_08_08.ino". I assume that is from the src directory.

Build button now available.
Confirmed the same errors as Arduino IDE:
error: initializer element is not constant item was declared as const.
error: unknown type name 'class'; in five(5) .hpp files of ten (10) .hpp files that declare a class.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Remote Linux login error
Reply #7 - Aug 8th, 2023 at 11:14pm
Print Post  
Add existing items will cause confusion. You just need to click the small icon above the solution explorer called "show all files". Then you can right click folders and files and select "Include".

I am unsure why you are trying to create project under the libararies folder. If you are trying to create a library then please create a new thread so that we can explain about libraries. Libraries are not projects and your own project should be located away from the libraries folder. This is unrelated to any issues you are having but important to note.

It is difficult to picture you config based on all the changes you have made. 

I can say that the "New Arduino Project" menu item will create solutions/projects below the Arduino sketch book folder which is normally Documents\Arduino. If you use the standard Visual Studio new project wizard you can specify where you want the project to be created. There is a Visual Micro new empty project template in the wizard. "File>New>Project"
« Last Edit: Aug 8th, 2023 at 11:21pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Lee Critchlow
Junior Member
**
Offline


Posts: 26
Location: TN
Joined: Jul 19th, 2022
Re: Remote Linux login error
Reply #8 - Aug 9th, 2023 at 12:12am
Print Post  
OK. I started over without the '_' to '-' renaming.
Used BC4 to copy the files.
Used the 'Show All Files' and selected all and 'Included In Project'.
Build button was gray.
Had to copy .ino to project folder to get the build button.
still getting the following errors:
error: initializer element is not constant item was declared as const.
error: unknown type name 'class'; in five(5) .hpp files of ten (10) .hpp files that declare a class.  Cry
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12188
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Remote Linux login error (Solved: Not using valid Arduino project structure)
Reply #9 - Aug 9th, 2023 at 12:37am
Print Post  
For compile errors please create a new thread and provide the information requested in yellow at the top of each forum page. I also suggest you email you zip and email your project at the same time because the problem will be related to your code.
« Last Edit: Aug 9th, 2023 at 12:39am by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint