Log in

View Full Version : Visual Studio


joeojazz
02-08-2016, 22:02
Our team wants to switch to c++ and program in Visual Studio we where wondering if it is possible to program and deploy code to the robo-rio from Visual Studio. We have found c sharp templates to deploy from Visual Studio but not a c++ one.

marshall
02-08-2016, 22:37
Our team wants to switch to c++ and program in Visual Studio we where wondering if it is possible to program and deploy code to the robo-rio from Visual Studio. We have found c sharp templates to deploy from Visual Studio but not a c++ one.

I'll bite... why Visual Studio?

balloman
02-08-2016, 23:50
I'll bite... why Visual Studio?

I assume because of how nice it is to code in Visual Studio

JamesTerm
03-08-2016, 00:02
I'll bite... why Visual Studio?

The Visual Studio compiler is much more powerful and easier to use... well easier for someone who uses it professionally on a daily basis. :)

Maybe I'm bias, but it has been so much preferred that we went through the trouble of writing all the code simulated in visual studio environment, and then porting it over later. As debugging remotely is a real nightmare and 10x more time consuming (that 10x is a conservative estimate, probably more time considering all the times we had to redeploy code).

Last I checked, visual studio 2013 and above can have an Arduino IDE environment, but I've never tested that yet. It could work, but then the trick would be to get WPI libraries built as well... or link to them from VS. I think it can be done, but I haven't really had a chance to pursue this.

Jaci
03-08-2016, 00:20
If you want to get the code to work nicely with Visual Studio, you're going to have to do a bit of manual work.

Step 1: Get the WPILib and NT-Core header files. These will usually be under ~/wpilib

You can add these to your project's header files include directory. This should fix up any false-alarm syntax errors you might be getting.

Step 2: Configure your build system.

This is a bit difficult. First, you need the FRC C++ toolchain installed and added to your PATH.

Next, you have to use some form of build system to send over and compile your code. You can use the one provided by WPILib for this.
WPILib uses ANT to build and deploy code. Visual Studio supports ANT builds and you can find instructions here (https://www.visualstudio.com/en-us/docs/build/steps/build/ant). Reconfigure your build targets to use this build system, and you should be set to go. If you're stuck looking for what tasks to run, run a simple build in eclipse and take note of what tasks are executed, that should help you.

Keep in mind this is only to build and deploy code. The code you build will not run on your system, as it's built for an ARM target (the roborio)

marshall
03-08-2016, 07:26
The Visual Studio compiler is much more powerful and easier to use... well easier for someone who uses it professionally on a daily basis. :)

I had no idea Visual Studio was a compiler. ::rtm::

That's sarcasm folks, calm down. For the record, I work in a plethora of development environments as well as compilers as a professional on a daily basis. They are all equally crap, except for VIM, which isn't technically an IDE but there are enough enhancements to it these days that I count it as one. ;)

Jaci
03-08-2016, 07:40
I had no idea Visual Studio was a compiler. ::rtm::

That's sarcasm folks, calm down. For the record, I work in a plethora of development environments as well as compilers as a professional on a daily basis. They are all equally crap, except for VIM, which isn't technically an IDE but there are enough enhancements to it these days that I count it as one. ;)


Visual Studio isn't a compiler, but MSVC is :P

I think the main attraction to Visual Studio is just how $@#$@#$@#$@# good IntelliSense is. The only system I've seen come close is JetBrains' code completion, but IntelliSense still tops it IMHO.

marshall
03-08-2016, 07:50
Visual Studio isn't a compiler, but MSVC is :P

I think the main attraction to Visual Studio is just how $@#$@#$@#$@# good IntelliSense is. The only system I've seen come close is JetBrains' code completion, but IntelliSense still tops it IMHO.

It does have some perks. If I were writing in a consistent language then I could see where that would be very useful. I've been using VS lately with some work in Unity and on the CTRE HERO board.

ozrien
03-08-2016, 11:30
...I think the main attraction to Visual Studio is just how $@#$@#$@#$@# good IntelliSense is...

+1 this.

JamesTerm
03-08-2016, 11:57
I had no idea Visual Studio was a compiler. ::rtm::

Yes, Visual Studio Compiler...
That's my wording and I'm sticking with it! ;)

Also... in your critique of Visual Studio... did you try it with the Visual Assist plugin? This really makes a difference.

ahaltom
03-08-2016, 13:06
If you want to get the code to work nicely with Visual Studio, you're going to have to do a bit of manual work.

Step 1: Get the WPILib and NT-Core header files. These will usually be under ~/wpilib

You can add these to your project's header files include directory. This should fix up any false-alarm syntax errors you might be getting.

Step 2: Configure your build system.

This is a bit difficult. First, you need the FRC C++ toolchain installed and added to your PATH.

Next, you have to use some form of build system to send over and compile your code. You can use the one provided by WPILib for this.
WPILib uses ANT to build and deploy code. Visual Studio supports ANT builds and you can find instructions here (https://www.visualstudio.com/en-us/docs/build/steps/build/ant). Reconfigure your build targets to use this build system, and you should be set to go. If you're stuck looking for what tasks to run, run a simple build in eclipse and take note of what tasks are executed, that should help you.

Keep in mind this is only to build and deploy code. The code you build will not run on your system, as it's built for an ARM target (the roborio)

Thanks for the reply, Jaci! It's great to see that someone has worked with robot code in Visual Studio. I've used Visual Studio a TON in college, so it really appeals to me more than Eclipse does (IntelliSense is amazing:cool:). I'll work with Joeojazz and try to get Visual Studio working properly. You may hear from Team 5712 in the next few days if we hit any bumps in the road, but we'll give it a shot!

Alex
Team 5712 Mentor

Rangel(kf7fdb)
03-08-2016, 13:33
If you are interested in using C#, RobotDotNet seems to be a pretty solid solution: https://www.chiefdelphi.com/forums/showthread.php?t=140972

marshall
04-08-2016, 00:16
Yes, Visual Studio Compiler...
That's my wording and I'm sticking with it! ;)

Also... in your critique of Visual Studio... did you try it with the Visual Assist plugin? This really makes a difference.

I am by no means a critic, just a cynic. I'll check out the plugin though. Always open to new stuff.

JamesTerm
04-08-2016, 09:03
I'll check out the plugin though. Always open to new stuff.

For reference:
http://www.wholetomato.com/

I've been using this since around 2002... (It works on all versions of visual studio)