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
Normal Topic AS 6.2: How I can work with Arduino and .cpp files? (Read 4919 times)
marcosargent
Newbies
*
Offline


Posts: 5
Joined: Apr 1st, 2016
AS 6.2: How I can work with Arduino and .cpp files?
Apr 5th, 2016 at 2:22am
Print Post  
Hi,
I try to use an Arduino Project with AS6.2 and .cpp files.
But when I Start an Arduino Project, I Can't see the Libraries, and only see .ino files.
I am confussed because I try to install AS10 and fail, and after that I installed AS6.2, and in AS10 it is possible.

Is possible with AS 6.2 work with .cpp files?
Thank you.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #1 - Apr 5th, 2016 at 3:09pm
Print Post  
Hi,

Are you new to Arduino?

Cpp files are fully supported. Libraries should be on the project menu. The product has changed since the AS6.2 version so documentation will be misleading.
« Last Edit: Apr 5th, 2016 at 3:10pm by Tim@Visual Micro »  
Back to top
IP Logged
 
marcosargent
Newbies
*
Offline


Posts: 5
Joined: Apr 1st, 2016
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #2 - Apr 5th, 2016 at 6:24pm
Print Post  
Hi,
I am working with Arudino since a year ago.
But I can't explain me very well.
In AS10, I see main.cpp when I start an Arduino Project, in AS6.2, only can see sketck.ino, and my questions is:
Is possible work with an main.cpp file in Arduino Project in AS6.2? 

Thank you very much!
Marcos
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #3 - Apr 5th, 2016 at 6:36pm
Print Post  
Okay thanks.

Arduino supports cpp/c/h files. You can add them to the project in As6.2 and also in As7. You then need to #include them into the project_name.ino

AS7 it incorrectly adds a main.cpp. It is not valid for Arduino because the arduino core defines a main.cpp in the background.

You can add cpp/h files to an arduino project by right click the project name in the "solution explorer > add new > cpp and header" or you can use any of the standard atmel windows to add files to a project.

Hope this makes sense

ps: atmel studio 7 confuses the arduino development which is why Visual Studio 2015 community is recommended. It is also free.

« Last Edit: Apr 5th, 2016 at 6:37pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #4 - Apr 5th, 2016 at 8:38pm
Print Post  
more: Adding a library is on the Project menu and there is also an option to "show Arduino core and libraries" on the same menu. Showing the core and libraries will add shortcuts to the underlying source codes to the project
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12163
Location: United Kingdom
Joined: Apr 10th, 2010
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #5 - Apr 9th, 2016 at 8:10pm
Print Post  
I just fixed a bug and it reminded me of something that might be useful. 

In visual micro (latest release) and the arduino ide you can add a cpp file to the project called "project_name.cpp"

Doing so causes the code in the .ino file(s) to be ignored and you should ensure that the cpp code has void setup() and void loop(). 

Other than the setup() and loop() methods, the cpp will work exactly like a normal .cpp but will be the main program code.
  
Back to top
IP Logged
 
marcosargent
Newbies
*
Offline


Posts: 5
Joined: Apr 1st, 2016
Re: AS 6.2: How I can work with Arduino and .cpp files?
Reply #6 - Apr 12th, 2016 at 2:31am
Print Post  
Administrator, 
Thanks, but in AS6.2 is not possible choice the option "solution explorer > add new > cpp and header".

Exist "solution explorer > add new > New Project", but I can not choice that you are saying.

The same luck with "show Arduino core and libraries"

Thanks!

  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint