Sunday, June 9, 2013

Modifications for Micosoft Visual C++ as code portable with with different compilers(TC,GCC...)

   
                                                                                                                     
Program 1)       #include "stdafx.h"                       
                         int main()
                        {
                          printf("Hello World\n");
                          return 0;
                         }
                         If we compile(ctrl+F5) above code(Program1) in MS Visual C++ compiler means it will work fine.

Program 2)      
                         int main()
                        {
                          printf("Hello World\n");
                          return 0;
                         }
                         If we compile(ctrl+F5) above code(Program1) in MS Visual C++ compiler means it will show the following error
"fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source?  "

MS Visual C++ compiler default contains " #include "stdafx.h" " included in source file,
if we work with this header no problems are arrive, but this is not a code portability how means, if we run the
same program in another compiler(Turbo C,GCC) means it will give error due to that header file.
So it is better to remove that header file by changing appropriate modifications in compiler settings,

For that you need modify 2 things
1) Change fromUse the  Precompiled Headers    to Not Using Precompiled Headers
  1)Goto the "solution explorer" menu
  2)Right click on the project name-->properties-->configuration properties-->C/C++-->Precompiled      
       header
      -->Click on Create/Use precompiled header(From right side)-->Click on triangular button  -->
         Not Using Precompiled Headers-->then apply-->Then Ok.

   3)Screen shots for above

a)


 b)


c)


 2) Change from  C++    to C  compiler:
       By default this compiler this compiler assumes our code is written C++ so that it will compile,
     so we need to change this one from C++ to C by following the below instructions

  1)Goto the "solution explorer" menu
  2)Right click on the project name-->properties-->configuration properties-->C/C++-->Advanced
      -->Click on Compile as (From right side)-->Click on triangular button  -->
         select the Compile as C Code (/TC)-->then apply-->Then Ok.

   3)Screen shots for above

 


 b)

 c)
 




Now your done.Your code contains portability with different compilers.

Reference: For more info refer let us" C solutions" text book  from sri Yashavant P. Kanetkar.





Solution for "Failed to install Microsoft Visual C++ 2010 on x86 WIndowsXp SP2 32 bit machine"

How to install Microsoft Visual C++ 2010 on Windows XP SP2


Alright guys this is a tutorial on how to install Microsoft Visual C++ 2010 on XP SP2.
 
I post this because we all know that Microsoft Visual C++ 2010 is not compatible in XP SP2 computers.

But I found a way on how to install it in SP2(From some blog).

If we try to install it in XP SP2, we will probably receive this:

 

Note: after you followed the steps below, your OS will be changed from SP2 to SP3. just like this:


Now to install it in your computer just follow this steps:
1. Click start ==> run ==> type "regedit" ( without the "" ) ==> go to HKEY_LOCAL_MACHINE ==> then system ==> current control set ==> control ==> WINDOWS.
2. Double click CSD version.
3. Change the value data from 200 to 300.
4. Click ok then close the regedit.
5. Restart your PC then you are done! you can now install your Microsoft Visual C++ 2010.


It worked for me.

Tuesday, October 16, 2012

హలో...

 నా మొదటి పోస్ట్ కి స్వాగతం సుస్వాగతం... 

"Your life today is what  you have done the past.
 You life tomorrow is what you going to do today."