Hi!
Is there a way that I can "Build" a single source file? Wihout creating a project? I want to be able to open a *.c file in Visual Studio and simply Build it with out having to choose a project. I know it's a whole different world but in Borland C for DOS I simly opened a file and hit Ctrl+F9.

Thanks.

Recommended Answers

All 5 Replies

I don't think you can build just an open file. But you can make a dummy project and get the same effect by removing the source files in the project and adding existing items instead of new items to it each time.

The easiest way for a single file is to type cl prog.c at the command prompt.

When you open a single file in Visual Studio (VC 6.0++), what it will ask if you want to open an project workspace. That is just something it needs internally and doesn't actually create a project. Just click on yes and you can compile a single file.

The way I do it is somewhat like Hamrick suggested -- create a project then change the source file(s) as needed. I test out many of the programs posted on the C and C++ boards that way.

The way I do it is somewhat like Hamrick suggested -- create a project then change the source file(s) as needed. I test out many of the programs posted on the C and C++ boards that way.

I kind of overlooked the fact that maybe you want to run the app in some way. My method only compiles the file, nothing else.

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.