Sunday, July 12, 2009

Easy visual C++ express edition question any programmer will know....?

I am starting to code in windows instead of linux, in visual C++ where is the compile button??? how do you compile code??? Also, in GNU compiler to use things such as vectors and strings you use:





#include%26lt;vector%26gt;


#include%26lt;string%26gt;








in visual C++ does it want you to always use:





#include%26lt;vector.h%26gt;


#include%26lt;string.h%26gt;





????





If i wrote my own class would I put





#include%26lt;myclass.h%26gt;





or





#include"myclass.h"





????








Thanks!

Easy visual C++ express edition question any programmer will know....?
In Visual C++ .NET, you compile individual projects by selecting Build -%26gt; Compile (or Ctrl+F7).


To compile an entire solution, you select Build -%26gt; Build Soultion (or F7).


To debug a solution (which compiles the solution and runs it using a specialised .NET framework for debugging, you select Debug -%26gt; Start Debugging (or F5).








Windows header files are generally put in the format '#include %26lt;windows.h%26gt;', although C++ native headers, like iostream, can he put in the format '#include %26lt;iostream%26gt;'.








Classes you create must be in the format '#include "myclass.h".
Reply:I'm just a newbie in Visual C++, but this is so far i know :


Compile = Ctrl+F7 (build menu)


Run without debugging = Ctrl+F5 (debug menu)





In Visual C++ i use :


#include %26lt;iostream%26gt;
Reply:1. Express doesn't have an IDE. You have to compile from the command line.


2. The include... .h forms are being deprecated in favor of include %26lt;vector%26gt;. Internally they'll probably refer to the .h anyway.


3. If you use "myclass.h" it will have to be in the current directory or have a fully qualified .h file name. If you use %26lt;myclass.h%26gt; it will have to be in the path specified by the compiler or by an environment variable (not sure which).
Reply:You can compile and run your code 2 ways


1. choose Build Solution under build


choose Start Debugging (or Start without debugging)


under debug


2. click the green triangle on the standard toolbar





The difference between header files with the .h extension and those without it, is whether or not they use namespaces. Those with the .h do not use them. Also, the .h versions of some header files are being phased out in newer compilers.


iostream.h is one of these files.





The quoted include files are used to include files that are not in a path the compiler can see. The angle brackets are used for files that can be seen. So you should use quotes for your class.


No comments:

Post a Comment