Armenak Palyan
Armenak Palyan

Reputation: 41

default project in Visual C++

I am lecturer in Armenian University. I teach “Programming in C++”. During my lecture I demonstrate and execute on the screen many C++ programs using Microsoft IDE (Visual C++). Many years I used Visual C++ 6.0. I executed programs just by double-clicking .cpp file without creating project. Visual C++ 6.0 created default project automatically. It was very convenient. Now I use new version - Visual C++ 2008 Professional Edition which has not such possibility. It is not convenient because I have to create project for each .cpp file.

My question: Is there a version of modern Visual C++ which has this possibility? Thank you in advance.

Upvotes: 4

Views: 243

Answers (1)

hsarret
hsarret

Reputation: 446

I don't know if any modern versions of visual studio provide that feature but you could use Premake to generate your project

Grab it here

Create a file named premake4.lua containing following lines

solution "MyApplication"
   configurations { "Debug", "Release" }

   -- A project defines one build target
   project "MyApplication"
      kind "ConsoleApp"
      language "C++"
      files { "**.h", "**.cpp" }

      configuration "Debug"
         defines { "DEBUG" }
         flags { "Symbols" }

      configuration "Release"
         defines { "NDEBUG" }
         flags { "Optimize" }

Copy premake4.lua inside your source's directory, let's say c:\lesson1

Then execute following command line inside same directory

c:\lesson1> premake4 vs2008

It will generate a solution and a project containing every .cpp, .h file in c:\lesson1 directory

I hope this helps, feel free to ask me for more details

Upvotes: 2

Related Questions