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!
Re: compile only one .cpp file???
It doesn't make any sense IMHO, to compile a single file without any project.
Re: compile only one .cpp file???
Quote:
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
Re: compile only one .cpp file???
Quote:
Originally Posted by
memeloo
Well, it is interesting info (and, probably, will be useful for OP)! :thumb:
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.
Re: compile only one .cpp file???
Quote:
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 :thumb:
Re: compile only one .cpp file???
i = (isEasier == true ? i-1 : i+1)
Re: compile only one .cpp file???
Quote:
Originally Posted by
memeloo
i = (isEasier == true ? i-1 : i+1)
I prefer:
Code:
if(isEasier)
++i;
else
--i;
Re: compile only one .cpp file???
How about:
Code:
const int increments[] = {1, -1};
i += increments[isEasier];
Re: compile only one .cpp file???
Quote:
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... :cool:
So it would be much more complicated to implement.
Re: compile only one .cpp file???
Quote:
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.
Re: compile only one .cpp file???
Quote:
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! :thumb:
Re: compile only one .cpp file???
Quote:
Originally Posted by
laserlight
How about
:
Code:
const int increments[] = {1, -1};
i += increments[isEasier];
nice :lol:
another one:
Code:
i += 1 * (isEasier * -1);
Re: compile only one .cpp file???
Quote:
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;
Re: compile only one .cpp file???
Quote:
Originally Posted by
laserlight
That won't work: if isEasier is false, the expression evaluates to 0, not -1.
****! :confused::mad::D how could i not see it :\
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.