Is it possible to compile a single .cpp (not a project) in visual studio 2008? Also will using visual studio cause problems executing code on a unix system?

I am making my first c++ "hello world" program and I am attempting to use visual studios. Am I going to have to make a project for every little thing I program?

It almost seems like a joke to have resource.h, stdafx.h, app.ico, app.rc, AssemblyInfo.cpp, stdafx.cpp, and Hello.cpp just for "hello world" lol.

Thanks for your help and advice on the matter. =)

Recommended Answers

All 3 Replies

AFAIK, you have to make a project first, and then add the main.cpp file as a source. Unless you want to do it manually using the Visual Studio 2008 command prompt and "cl.exe" to compile.

>>Is it possible to compile a single .cpp (not a project) in visual studio 2008
No.

>>Also will using visual studio cause problems executing code on a unix system?
If you mean run the *.exe on *linux, the answer is that it cannot. You will have to compiler it on the machine you want to run it on, in this case a *nix computer. The binaries are not compatible between the two operating systems.

>>It almost seems like a joke to have resource.h, stdafx.h, app.ico, app.rc, AssemblyInfo.cpp, stdafx.cpp, and Hello.cpp just for "hello world" lol.

You can create an empty project and add your own *.cpp file(s) to it.

>It almost seems like a joke to have resource.h, stdafx.h, app.ico, app.rc, AssemblyInfo.cpp, stdafx.cpp, and Hello.cpp just for "hello world" lol.

You don't need all those files, when making a new project, remember to choose "Empty Project" in the additional options while in the wizard.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.