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) Open sketch works, open solution fails to build (Read 9156 times)
bainbob
Junior Member
**
Offline


Posts: 13
Joined: Feb 20th, 2015
Open sketch works, open solution fails to build
Mar 9th, 2015 at 6:38pm
Print Post  
If I use "open sketch" I can build and run my project, but if I open the solution (or project) it fails to build (lots of errors, especially macro definition problems).

Bob
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #1 - Mar 9th, 2015 at 11:08pm
Print Post  
Hi Bob,

Please switch on tools>visual micro>verbose messeges

Then click Build>clean solution

Then build and email the output to info [at] visualmicro.com

Please also state which hardware, arduino version and visual studio version you are using

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #2 - Mar 10th, 2015 at 9:38pm
Print Post  
Hi Bob,

Thanks for the info.

The compile you see is a standard visual studio Win32 C++ compile which means that Visual Micro does not think you have a sketch open.

Can you please post a screen shot of your ide with a sketch open.

There are a few rules that need to apply before Visual Micro will manage the project. The best way to create or open a sketch project for the first time is to follow the "first steps" guides in the documentation.

When Visual Micro creates a sketch or automatically configures a project for an existing sketch the correct rules should automatically be applied for you.

When Visual Micro handles the compile you will see this message:-

Code
Select All
Compiling 'SketchName' for 'hardware/board name' 




The rules for your information are:-

The project name and folder name must match and there must be a .ino file of the same name in the folder.

For example:-

"myDocuments\Arduino\Sketch1\Sketch1.ino"
"myDocuments\Arduino\Sketch1\Sketch1.vcxproj"

and the Visual Studio internal project name would also be Sketch1
« Last Edit: Mar 10th, 2015 at 9:39pm by Tim@Visual Micro »  
Back to top
IP Logged
 
bainbob
Junior Member
**
Offline


Posts: 13
Joined: Feb 20th, 2015
Re: Open sketch works, open solution fails to build
Reply #3 - Mar 11th, 2015 at 2:41pm
Print Post  
Hello Tim,
If you looked at the visual studio project file that I sent you then you should know that the 3 rules you specified are in fact satisfied. You are correct that it doesn't detect it as a visual micro project and intercept it, the question is WHY? If I open it as a sketch (instead of a project) it works. If I close and re-open .MsgPumpTest.vsarduino.h in the editor before building it works. If I just open the project and build it fails. Please take another look and see if you can figure out why this happens. At this point I only have VS 2013 Premium installed (I had 6, 2005, 2008, 2010 but did a clean install when I went to 2013) so I can't check this behavior against anything else.

Thanks.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #4 - Mar 11th, 2015 at 2:45pm
Print Post  
Hi,

Thanks for the info.

Can I please see the build output from when it works.

After it fails please view the list of output windows and select "Micro Build" then tell me what is shows

Thanks

ps: It doesn't matter which version of vs is installed. 2013 is fine
« Last Edit: Mar 11th, 2015 at 2:46pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #5 - Mar 11th, 2015 at 4:10pm
Print Post  
Hi Bob,

Thanks for the output

When it fails can you please email the contents of the "Micro Build" output window

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #6 - Mar 13th, 2015 at 1:17am
Print Post  
Thanks for clarifying and sorry for the delay.

It's interesting that the Micro Build window shows a successful build and reports the program size.

This means the build phase is complete.


When you get the error.

Are you click Build>Build Project or Build Solution? Or are you attempting to build and upload?

Thanks
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #7 - Mar 13th, 2015 at 1:44pm
Print Post  
Hi Bob,

I have tried out your project and it works okay for me in all situations. Sorry to say.

I can also say that when you use file>open>sketch, if the sketch project already exists, we run the VS open project macro. So this makes it very confusing because Visual Micro doesn't do any clever (or otherwise) when a sketch opens. We are just opening a standard VS project.

The vsarduino can be ignored from all discussion. I think opening it adds some line feeds that VS likes when it wrongly attempts to compile regardless of success or fail.

You say that other projects work fine for you? Are the other test sketches located in the same place on your pc. It's the only thing I can think of that might be different. 

I can't at the moment think what would cause this other than another Visual Studio extension or add-in is preventing Visual Micro from managing the build. I know this doesn't make sense because it works when you open via sketch>open but it's all I can think of.

Can you confirm that if you use File>Sketch>open the compile ALWAYS works?

Thanks
  
Back to top
IP Logged
 
bainbob
Junior Member
**
Offline


Posts: 13
Joined: Feb 20th, 2015
Re: Open sketch works, open solution fails to build
Reply #8 - Mar 13th, 2015 at 6:11pm
Print Post  
Yes, File->Open->Sketch Project  always works. File->Open->Project/Solution does not work UNLESS I close and re-open vsarduino.h (if I do that it always works).
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #9 - Mar 13th, 2015 at 6:28pm
Print Post  
Sorry to be a pain but are you saying that if you close and re-open vsarduino the Win32 compile works or the Arduino compile?

And Arduino compile will show something like this and nothing else

Code
Select All
Compiling sketch xyz for board
Binary sketch size: 1,008 bytes (used 3% of a 32,256 byte maximum) (10.64 secs)
Minimum Memory Usage: 9 bytes (0% of a 2048 byte maximum) 


« Last Edit: Mar 13th, 2015 at 6:29pm by Tim@Visual Micro »  
Back to top
IP Logged
 
bainbob
Junior Member
**
Offline


Posts: 13
Joined: Feb 20th, 2015
Re: Open sketch works, open solution fails to build
Reply #10 - Mar 13th, 2015 at 7:14pm
Print Post  
YES. If I close and reopen vsarduino.h then it compiles just fine (as an arduino project, uses gcc, etc). And it shows something similar to what you depict except a lot more verbose since I checked "verbose messages", and that's why I know it's using gcc. The point is that reopening vsarduino.h makes it work right. Otherwise I have to open it as a sketch instead of a visual studio project.

If I don't reopen vsarduino.h then it thinks it is a win32 (x86) project instead of arduino (so of course it can't build it).
« Last Edit: Mar 13th, 2015 at 7:24pm by bainbob »  
Back to top
 
IP Logged
 
bainbob
Junior Member
**
Offline


Posts: 13
Joined: Feb 20th, 2015
Re: Open sketch works, open solution fails to build
Reply #11 - Mar 13th, 2015 at 7:33pm
Print Post  
I'm going to drop this whole thing for now because I found another workaround.  If I simply double click the solution file (instead of file-open-project/solution) it opens in studio and builds correctly. This seems to be a plug-in issue but I don't have time to pursue this right now (and I don't want to waste your time either). I might come back to it later and try to figure out what is happening. If I do I'll follow up on this thread.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12187
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Open sketch works, open solution fails to build
Reply #12 - Mar 13th, 2015 at 7:42pm
Print Post  
Thanks, that makes a but more sense to me possibly. To determine if Visual Micro needs to build it looks for the selected project and if a project or file of a project is not selected it looks for the start-up project. This caters for multi project solutions.

If/when you get back to it I would like to see a screen shot of what is selected when the ide opens and fails.

Thanks for all the effort sorry it's been such a strange one.

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