0

I am Unix guy but for a project I need to code in VS 2015. Basically I need to write some GMOCK test cases for some C++ classes.

I first tried to start with a sample project so I selected File->New->Project->Win32->Win32 Console Application. The project did got created with a default name ConsoleApplication2.cpp having embedded statement -

#include "stdafx.h"

I found that if I delete this line the code fails to compile - Usually in Unix I create .h and .cpp files and then create its make file - my aim was to start a project - create some .h files first and then create its .cpp / GMOCK test cases and build then build all

Please let me know if there is an option in VS for same or the way to do so?

273K
  • 29,503
  • 10
  • 41
  • 64
Programmer
  • 8,303
  • 23
  • 78
  • 162
  • 1
    You can go to Project Settings->C/C++->Precompiled headers and on right pane change the settings by removing precompiled header file – Asesh Jul 28 '17 at 04:57
  • 1
    After you select "Win32 Console Application", click "Okay". On the next dialog click "Next" then select "Empty Project". That will give you a project without precompiled headers or any additional files. – Blastfurnace Jul 28 '17 at 05:07
  • @Blastfurnace: That's a valid answer, could you copy your comment to an answer below? – MSalters Jul 28 '17 at 07:57

2 Answers2

0

for the use of stdafx.h please see the link Here

If you want to add a header file and then the respective cpp file the you just need to go to the project in solution explorer at right side of your IDE. Right click and go for add. There you will get the option for header file and class both. You can add from there and start writing your code for the test cases.

0

The steps to create an empty project without precompiled headers or additional default source files are:

  • After you select "Win32 Console Application" click "OK".
  • On the following dialog click "Next" to go to the Application Settings page.
  • Select the "Empty project" option and then click "Finish".

The "Empty project" option says:

This option creates a .vcxproj file based on the project name you specified but adds no files to it. Use this when you intend to supply all your own source files.

Blastfurnace
  • 18,411
  • 56
  • 55
  • 70