Hi!
I am using Dev-C++ and when I am trying to compile a program in it, it is showing many errors. All the settings seems to be right. Can I compile a program including header files like conio.h and iostream.h and using namespace std in Dev-C++? If not please suggest a good compiler in which I can do a program containing the header files mentioned above. I tried doing the same program in turbo C++ and microsoft visual studio 2010 express and it is working properly. If this problem in Dev-C++ is due to any settings that has to be done, please tell. I have installed Dev-C++ correctly.

Someone, please help me out!:confused:

No wonder you're confused.

I am using Dev-C++ and when I am trying to compile a program in it, it is showing many errors. All the settings seems to be right. Can I compile a program including header files like conio.h and iostream.h and using namespace std in Dev-C++?

You are using 3 different eras of programming

  • 1980's - conio.h from non-Standard C programming. Suggestion - remove it and all functions used from it.
  • Pre-standard C++ using iostream.h -- again old and substandard. Upgrade to iostream, no extension.
  • namespace std for use with today's standard headers with no extension.

Decide what era you want to compile and fix the code to that standard.

commented: thank you sir for your suggestion +0

DevCpp again! WaltP nailed it, plus you need to update your Mingw and get rid of what came with your IDE. Alternatively use wxDevCpp which is updated version of DevCpp plus wxWidgets RAD

Hi!
I am using Dev-C++ and when I am trying to compile a program in it, it is showing many errors. All the settings seems to be right. Can I compile a program including header files like conio.h and iostream.h and using namespace std in Dev-C++? If not please suggest a good compiler in which I can do a program containing the header files mentioned above. I tried doing the same program in turbo C++ and microsoft visual studio 2010 express and it is working properly. If this problem in Dev-C++ is due to any settings that has to be done, please tell. I have installed Dev-C++ correctly.

Someone, please help me out!:confused:

Updating your Mingw and [getting] rid of what came with your IDE will not help. The problems will still occur with an updated compiler.

LOL! @WaltP: Pretty good timing for this thread! Don't you think?

Yet another example of "I compile this with DevC++ and it doesn't work, but it works with other IDEs like ..".

@OP: I agree with both posters. Stick to one generation of C++ code, that is, the current standard, and standard-only. Follow WaltP's recommendation on that. Don't follow example codes or tutorials that are too outdated or non-standard (and seeing "iostream.h" or "conio.h" is a pretty good indication of that). But I would also recommend you pick another IDE besides DevC++, like Code.Blocks or Visual Studio, and try to pick a recent version.

Updating your Mingw and [getting] rid of what came with your IDE will not help. The problems will still occur with an updated compiler.

You overlooked this below ;)

WaltP nailed it

LOL! @WaltP: Pretty good timing for this thread! Don't you think?

Yet another example of "I compile this with DevC++ and it doesn't work, but it works with other IDEs like ..".

:D

But I would also recommend you pick another IDE besides DevC++, like Code.Blocks or Visual Studio, and try to pick a recent version.

Duh! DevCpp dies hard :)

I am studying in class 11 and I need a compiler for my study purpose not to learn C++ programming as a whole. So what can I do to make it work perfectly allright?
I am using Dev C++4.9.9.2. I think iostream.h is already there in the compiler, but still it is showing errors while doing even a small program including iostream.h. To understand my problem I have provided a small program that I tried out in Dev-C++ and the errors that the compiler is showing.Here is the program that I tried out!

#include<iostream.h>
void main()
{
cout<<"Welcome to microchip Computer Education";
}

These are the errors that are shown-

Line:1
File:C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31,from D:\CPPdoc\welcome to microchip computer education.cpp
Message:In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from D:\CPPdoc\welcome to microchip computer education.cpp

Line:1
File:D:\CPPdoc\welcome to microchip computer education.cpp
Message:from D:\CPPdoc\welcome to microchip computer education.cpp

Line:32:2
File:C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h
Message:#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 <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

Line:3
File:D:\CPPdoc\welcome to microchip computer education.cpp
Message:`main' must return `int'
This program compiles properly in Turbo C++. Please tell me what might be the problem with the compiler.

Thank you everyone for your suggestions!

If you are going to post a question, and you get responses, read the damn posts! You have been told how to fix this. By me and the compiler.

If they are teaching you to use void main() and iostream.h you can either
1) Find a new instructor that will teach current coding practices
2) Understand that you are learning how to program 1980's code and your knowledge of programming will be severely handicapped when done.

I am studying in class 11 and I need a compiler for my study purpose not to learn C++ programming as a whole. So what can I do to make it work perfectly allright?
I am using Dev C++4.9.9.2. I think iostream.h is already there in the compiler, but still it is showing errors while doing even a small program including iostream.h. To understand my problem I have provided a small program that I tried out in Dev-C++ and the errors that the compiler is showing.Here is the program that I tried out!

#include<iostream.h>
void main()
{
cout<<"Welcome to microchip Computer Education";
}

These are the errors that are shown-

Line:1
File:C:\Dev-Cpp\include\c++\3.4.2\backward\iostream.h:31,from D:\CPPdoc\welcome to microchip computer education.cpp
Message:In file included from C:/Dev-Cpp/include/c++/3.4.2/backward/iostream.h:31, from D:\CPPdoc\welcome to microchip computer education.cpp

Line:1
File:D:\CPPdoc\welcome to microchip computer education.cpp
Message:from D:\CPPdoc\welcome to microchip computer education.cpp

Line:32:2
File:C:\Dev-Cpp\include\c++\3.4.2\backward\backward_warning.h
Message:#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 <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.

Line:3
File:D:\CPPdoc\welcome to microchip computer education.cpp
Message:`main' must return `int'
This program compiles properly in Turbo C++. Please tell me what might be the problem with the compiler.

Thank you everyone for your suggestions!

1. Mains ALWAYS return integer
2. iostream.h used tobe...but no more use <iostream>
That being said, new program should look

#include<iostream>
int main()
{
     cout<<"Welcome to microchip Computer Education";
}

and it is missing purposely...google before you post it error ;)

you forgot something important...

using namespace std;

or...

std::cout<<....

AND...

return 0;

... at the end of the program.

it will look like this:

#include<iostream.h>
using namespace std;
int main()
{
cout<<"Welcome to microchip Computer Education";
return 0;
}

the .h after iostream doesn't matter

#include<iostream.h>
using namespace std;
int main()
{
cout<<"Welcome to microchip Computer Education";
return 0;
}

the .h after iostream doesn't matter

WRONG!!! It matters big time! Only the headers without the .h require the namespace commands/indicators. The .h headers are old and should not be used at all in today's C++ compilers.

The program that teo236 gave is working perfectly and no error is shown but the command prompt opens and closes immediately. Why is that so?

The program that teo236 gave is working perfectly and no error is shown but the command prompt opens and closes immediately. Why is that so?

Sounds like you need spoon feeding! No way, you have to read

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.