locked
C++ setup RRS feed

  • Question

  • I'm a complete newbie to Robotics and have been playing around with a few of the VPL labs and tutorials for a start. Today I thought I'd try to work through the C++ tutorials to see how that works. I should also add that, while I know most of  the basics (I think), I'm by no means a C++ expert either. So, for me, it's also a C++ learning experience here.

    I followed the instructions for what you do from command prompt, and that all seemed to work (in the documentation > Tutorials > Basic Robotics Tutorials > C++). But already at the end of Step 1: Add References I'm confused. I'm not familiar with the syntax:

    namespace bumper = Microsoft::Robotics::Services::ContactSensor::Proxy;

    If I put that verbatim into the MyTutorial1.h file as the first line after #include "MyTutorial1Types.h", am I thus making bumper an alias for the namespace Microsoft::Robotics::Services::ContactSensor::Proxy? I'm assuming that one is supposed to put that line in verbatim at that spot in the file (?).

    Then since the instructions call for a namespace DIRECTIVE (my emphasis), does that mean that I need to follow up with a line like:

    using namespace bumper;

    And insert that line right after the "namespace bumper = ...;" line?
    Sunday, October 25, 2009 11:33 PM

Answers

  • This is really a C++ question and not specific to Robotics :-)

    Have a look at this page:
    http://msdn.microsoft.com/en-us/library/aewtdfs3.aspx

    If you specify namespace bumper = Microsoft... then you can use bumper:: as an alias instead of typing the whole namespace.
    If you use using namespace Microsoft... then you do not have to specify any prefix for methods in the namespace, but this could result in name conflicts if two namespaces have similar methods, which is one reason to use an alias.

    On a completel different topic, have you considered using C#? You will find it very much easier to use with Robotics Developer Studio than C++ and if you don't know C++ the learning curve for C# will not be much different.

    Trevor

    • Marked as answer by Aisthesis Thursday, October 29, 2009 3:06 AM
    Tuesday, October 27, 2009 5:51 AM

All replies

  • This is really a C++ question and not specific to Robotics :-)

    Have a look at this page:
    http://msdn.microsoft.com/en-us/library/aewtdfs3.aspx

    If you specify namespace bumper = Microsoft... then you can use bumper:: as an alias instead of typing the whole namespace.
    If you use using namespace Microsoft... then you do not have to specify any prefix for methods in the namespace, but this could result in name conflicts if two namespaces have similar methods, which is one reason to use an alias.

    On a completel different topic, have you considered using C#? You will find it very much easier to use with Robotics Developer Studio than C++ and if you don't know C++ the learning curve for C# will not be much different.

    Trevor

    • Marked as answer by Aisthesis Thursday, October 29, 2009 3:06 AM
    Tuesday, October 27, 2009 5:51 AM
  • I think they do want namespace =. After writing this, I discovered in one of the included files some sample code that was very helpful in explaining how to proceed.

    I do have about 5 months of work into C++, just have done almost nothing where I'm working with this kind of predefined libraries. I'm planning on learning C#, too, just now am still concentrating and don't want to sidetrack myself too much.
    Thursday, October 29, 2009 3:05 AM