Get Updates Via Email

Enter your email address:

Delivered by FeedBurner

About Me

facebook.com/Athul.Jayachandran twitter.com/athuljc

Followers

Dev C++ compiling problem fixed

Bloodshed Dev-C++ 4.9.9.2
While i began using Dev C++ to do cpp programs as my laptop(a dell xps 16) runs on 64-bit Windows Vista OS and doesn't support normal compilers like the Turbo C++.

Consider the program i have written in Dev C++ which shows a few errors:


#include
#include
void main()
{
     int a,b;
     cout<<"Enter two numbers whose sum to be found :";
     cin>>a>>b;
     cout<<"\n The sum is: "<
     getch();
}


Now this program in logic doesn't have any errors can be compiled and used under Turbo C++ compiler and not on this one.The errors for the above written program are listed below:



  • 1 C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31,               from C:\Users\Athul Jayachandran\Desktop\sum.cpp In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31,               from C:\Users\Athul Jayachandran\Desktop\sum.cpp 
  • 32:2 C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the header for the header for C++ includes, or instead of the deprecated header . To disable this warning use -Wno-deprecated. 
The following two errors occur due to the calling of header file iostream.h so instead of calling iostream.h call  just iostream using a pre-processor and also instead of cout and cin use std::cout and std::cin and try compiling again.This should work.

Now the code would change to the following:


#include
int main()
{
     int a,b;
     std::cout<<"Enter two numbers whose sum to be found :";
     std::cin>>a>>b;
     std::cout<<"\n The sum is: "<
}



Compiler returns no errors now

Program has been compiled and run.
I tried compiling this same and this worked.Hope this helps, Have a nice day !



0 comments

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Search This Blog