Visual Studio Tutorials: Setting up Visual Studio

From NXT++

Jump to: navigation, search

Lately, many people have had trouble compiling with NXT++ using VC++. I decided to make this tutorial to clear up confusion. I am a visual learner, so I hope these screenshots will be of assistance to those like me. Let's begin.

image:vcppss1.png

After opening up VC++, create an new project by going to File->New->Project....

image:vcppss2.png

When the dialog comes up, make sure you select Win32 Console Application and give the new project a useful name. Click OK.

image:vcppss3.png

After that, a new dialog pops up. It lets you configure your project a little more. We want to make a blank project, so we go to Application Settings and check Empty Project. Click Finish.

image:vccss4.png

Once inside the project, we need to create a new .cpp file. Do this by right clicking Source Files (in the left sidebar for me) and going to Add->New Item....

image:vccss5.png

In the new dialog, be sure to mark C++ File(.cpp) and give it a name also. Click Add to continue.

image:vccss6.png

Put some code in. Simple as that.

image:vccss7.png

Normal code would compile right now. NXT++ projects require a little more attention to the project settings. To edit the settings, got to Project->[Project's name] Properties... in the menu.

image:vccss8.png

This takes you to a confusing dialog. Fortunately for us, we only have to pay attention to 3 things. For the first, in the settings tree, navigate to Configuration Properties->C/C++->General. After that, go to Additional Include Directories and type in where your NXT++ /include folder is. This shows VC++ where to find NXT++.h Just forget the $(SolutionDir) stuff from the screenshot. One example would be 'C:\nxt++files\include'.

image:vccss9.png

Now, navigate to Configuration Properties->Linker->General. This is similar to the last step. All you have to do is go to Additional Library Directories, and add the location of your NXT++ /bin/win32 folder is. This shows VC++ where to find the NXT++ library file you built earlier. Again, forget about $(SolutionDir). An example would be C:\nxt++files\bin\win32'.

image:vccss10.png

Only one more setting to go. Navigate to Configuration Properties->Linker->Input, and look at Additional Dependencies. From there, just add NXT++d.lib if you are under the debug configuration or just plain NXT++.lib if you are under the release configuration.

image:vccss11.png

Finally to compile, go to Build->Build Solution in the menu.

image:vccss12.png

This is what the build output should look like if you did everything correctly. If not, and you cannot figure out why, start a new thread on the forums. Good luck and happy coding!

Personal tools