Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 27th, 2006, 8:30 AM   #1
sharadpro
Newbie
 
Join Date: Feb 2006
Location: India
Posts: 25
Rep Power: 0 sharadpro is on a distinguished road
Compiling .cpp file using Microsft Visual Studio 2005

Can anyone pls tell me how to compile n build a single .CPP file<program>
using Microsoft Visual Studio 2005 <Express Edition>without creating a project n solution as is possible in Visual Studio 6.
When I make a .CPP file in Visual Studio 05, there is no option to build or compile the program until I make a project , while in VS 6 , one can complie a single a .CPP file.
sharadpro is offline   Reply With Quote
Old Mar 27th, 2006, 8:35 AM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
This is my experience (possibly I haven't exhaused all measures): one can make a source file without a project, but one cannot build it. Incidentally, .cpp files are C++ files, so this should be in that forum.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 27th, 2006, 8:37 AM   #3
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
See my answer under your post in the C forum. Please don't cross-post. Please DO read the forum's rules/FAQ and a "How to Post" thread (always a good move for a new member in a community).
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 27th, 2006, 8:38 AM   #4
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
You cannot do that anymore. You can do that with some other IDE like Dev-C++ though. You can also just compile a native C++ program from the command line.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 27th, 2006, 8:38 AM   #5
Polyphemus_
Expert Programmer
 
Polyphemus_'s Avatar
 
Join Date: Aug 2005
Location: Rotterdam, the Netherlands
Posts: 942
Rep Power: 3 Polyphemus_ is on a distinguished road
Please do not crosspost. AFAIK, there is no such option. A solution is, I use this one, to create a project you use for only one or two files. You add the file to the project, you compile it, and you exclude it from your project again.
Polyphemus_ is offline   Reply With Quote
Old Mar 27th, 2006, 8:43 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
I have an "examples" project. I just move stuff in and out of it.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 27th, 2006, 8:48 AM   #7
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by DaWei
I have an "examples" project. I just move stuff in and out of it.
Hehe I have that too, except I have one for console, and another for win32 projects.
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Mar 27th, 2006, 9:05 AM   #8
sharadpro
Newbie
 
Join Date: Feb 2006
Location: India
Posts: 25
Rep Power: 0 sharadpro is on a distinguished road
When I make an empty project n compile a single file , it is fine but when I add program to it
Error on build ::
error LNK2005: _main already defined
How to solve this?
sharadpro is offline   Reply With Quote
Old Mar 27th, 2006, 9:58 AM   #9
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
First guess: two source files in the project, both with a "main." I think my crystal needs new 'ball' joints....
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Mar 27th, 2006, 10:07 AM   #10
Seif
Hobbyist Programmer
 
Seif's Avatar
 
Join Date: Jan 2006
Location: UK
Posts: 213
Rep Power: 3 Seif is on a distinguished road
Thought you only just got them changed?
Seif is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:42 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC