|
-
December 17th, 2009, 02:51 AM
#1
compile only one .cpp file???
I'm fairly new to C++, so everything I do is with a single .cpp file. When I used the Bloodshed Dev C++ IDE, I was able to compile and run a single source file. I recently started using Visual C++ 2008 (express edition, if that matters) and now it seems like I can not compile a single file--I have to stick it inside a project in order to compile it. Is there a way around this? With Visual C++ can I compile a single .cpp file without using a "project"?
Any help would be greatly appreciated. Thanks!
-
December 17th, 2009, 03:28 AM
#2
Re: compile only one .cpp file???
It doesn't make any sense IMHO, to compile a single file without any project.
Victor Nijegorodov
-
December 17th, 2009, 03:47 AM
#3
Re: compile only one .cpp file???
 Originally Posted by VictorN
It doesn't make any sense IMHO, to compile a single file without any project.
i'm sorry, but you're comment either... he didn't ask whether it makes sense but how to do it, so probalby it makes sense in his case
@jdqie
http://msdn.microsoft.com/en-us/library/ms235639.aspx
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 17th, 2009, 04:39 AM
#4
-
December 17th, 2009, 04:48 AM
#5
Re: compile only one .cpp file???
As for me - I don't like using command prompt when I can use VS IDE with all its features as debugging, break points, watch, output and other windows and so on
++i
"I studied everything but never topped. Today, toppers of the world's best universities are my employees"
-William Henry Gates (Bill Gates)
-
December 17th, 2009, 04:55 AM
#6
Re: compile only one .cpp file???
i = (isEasier == true ? i-1 : i+1)
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 17th, 2009, 05:15 AM
#7
Re: compile only one .cpp file???
 Originally Posted by memeloo
i = (isEasier == true ? i-1 : i+1)
I prefer:
Code:
if(isEasier)
++i;
else
--i;
Victor Nijegorodov
-
December 17th, 2009, 05:29 AM
#8
Re: compile only one .cpp file???
How about:
Code:
const int increments[] = {1, -1};
i += increments[isEasier];
-
December 17th, 2009, 05:55 AM
#9
Re: compile only one .cpp file???
 Originally Posted by laserlight
How about :
Code:
const int increments[] = {1, -1};
i += increments[isEasier];
It won't work for bool isEasier, only for int for which only 0 and 1 are allowed... 
So it would be much more complicated to implement.
Victor Nijegorodov
-
December 17th, 2009, 06:03 AM
#10
Re: compile only one .cpp file???
 Originally Posted by VictorN
It won't work for bool isEasier, only for int for which only 0 and 1 are allowed...
There exists an implicit conversion from bool to int whereby false is converted to 0 and true is converted to 1.
-
December 17th, 2009, 06:22 AM
#11
Re: compile only one .cpp file???
 Originally Posted by laserlight
There exists an implicit conversion from bool to int whereby false is converted to 0 and true is converted to 1.
Good to know it!
Thank you!
Victor Nijegorodov
-
December 17th, 2009, 10:18 AM
#12
Re: compile only one .cpp file???
 Originally Posted by laserlight
How about :
Code:
const int increments[] = {1, -1};
i += increments[isEasier];
nice 
another one:
Code:
i += 1 * (isEasier * -1);
Last edited by memeloo; December 17th, 2009 at 10:20 AM.
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 17th, 2009, 11:34 AM
#13
Re: compile only one .cpp file???
 Originally Posted by memeloo
another one:
That won't work: if isEasier is false, the expression evaluates to 0, not -1.
But I realise that my hack has a similiar bug: the array elements should be swapped.
Anyway, we could adapt your example:
Code:
i += isEasier * -2 + 1;
-
December 17th, 2009, 11:46 AM
#14
Re: compile only one .cpp file???
win7 x86, VS 2008 & 2010, C++/CLI, C#, .NET 3.5 & 4.0, VB.NET, VBA... WPF is comming
remeber to give feedback  you think my response deserves recognition? perhaps you may want to click the Rate this post link/button and add to my reputation
private lessons are not an option so please don't ask for help in private, I won't replay
if you use Opera and you'd like to have the tab-button functionality for the texteditor take a look at my Opera Tab-UserScirpt; and if you know how to stop firefox from jumping to the next control when you hit tab let me know
-
December 17th, 2009, 11:48 AM
#15
Re: compile only one .cpp file???
i += !isEasier - isEasier;
Probably the best one to make people scratch their heads twice figuring out what this does.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|