7

I saw questions similar to this for older versions of Visual Studio but not this latest version. I am following a course on Lynda.com and basically the instructor is trying to use C++ in a pure form that will look the same for students using a visual IDE on Mac. Anyway, the instructor sets up a Working project for teaching the language constructs and such. He right clicks on the project in Visual Studio and under C++ there is Pre-processor section.

I should note that he is using VS 2013 Community Edition. I have a more fully featured version of VS 2015. I don't see that option for defining pre-processor directives on a "project" basis. MS won't let me install 2 copies of VS 2015, but maybe it will let me install VS 2013.

Still, I hope my question makes enough sense as to what we are trying to accomplish, so that I can find the option in VS 2015 Enterprise. Thanks, Bruce

3
  • What exactly you want to do? AFAIK you can't define pre-processor directives - they are hard coded in the preprocessor. Do you mean "enabling certain directives that are disabled by default"? Or do you mean "defining macros"? What exactly you want to "define" and why? Commented Oct 28, 2015 at 8:26
  • 2
    I seriously doubt the enterprise edition does not support something as basic as adding PP entries while the community version does? I can be wrong of course, but are you saying that if you right-click your project (it is a C++ project, right?), you do not have Properties->Configuration Properties->C/C++->Preprocessor ??
    – stijn
    Commented Oct 28, 2015 at 8:44
  • Are we talking about simply #ifdef MY_VAR ? While used heavily, though not recommended. Commented Oct 28, 2015 at 9:11

2 Answers 2

14

You would need to at least add a .cpp file to your Source Files folder in the the current project that you right will click. That should give you the option you are looking for in Visual Studio 2015.

2
  • 1
    That was the solution to my problem, hoping for this to get more visibility. Thanks a lot ! Commented Jul 23, 2016 at 10:33
  • I am still trying to find this elusive "C/C++" group in the property page for 2017. The repository I am trying to build in the solution has the main project that only references the other parts, and has no cpp files itself. Coming from eclipse I knew how to make a new source folder, file, and add it to the build path, but I am not sure how to do it here. Simply making the 'filter' and a new cpp file inside does not show me the group. I still only see some basic ones and "VC++ Directories".
    – Pysis
    Commented Oct 15, 2017 at 5:37
7

Right click on your project. Select Properties. You should see the below menu where you can navigate to Configuration Properties > C/C++ > Preprocessor.

This is how I see it in my Visual Studio Enterprise 2015.

Is this what you're looking for?

enter image description here

3
  • Yes, that is what I am seeking. It was hard finding a project type, though, that would show the C/C++ section in the Properties. I tried several types of applications that one might want to use for just basically learning c++ and which would thus just generate a console application. Many of my choices when I created the project, there was no section in the Property Pages for C/C++ settings. The drop-down was just not there for c/c++. I would think that if one chose C++ application, you would have a section for C/C++ options. Commented Nov 14, 2015 at 21:06
  • 1
    Where are %(PreprocessorDefinitions) coming from? Commented Mar 31, 2017 at 7:24
  • @AndrewSavinykh I have no idea. I only answered this question at the time because I happened to see it pop up in the queue while I was also trying to figure out how to do it myself. You should probably open a new question here on SO.
    – ThisClark
    Commented Mar 31, 2017 at 13:31

Not the answer you're looking for? Browse other questions tagged or ask your own question.