not able to include few header files in dev c++ - header-files

When i include few header files like #include "afxwin.h" and #include "afxext.h" in Dev C++, its showing me file not found. Can anyone help me?

I was having the same problem and this worked for me
In filename.cpp, I put: #include "full path to filename.h"
When using the file, I had put: #include "full path to filename.h" and #include "full path to filename.cpp"

These are MS Visual C++ precompiled headers (related to MFC):
http://en.wikipedia.org/wiki/Precompiled_header
You might get lucky and be able to compile and use them in combination with GCC/Dev-C++, but I wouldn't bet on it (see the third comment on the opening post):
How do I move from the MSVC compiler to GCC on Windows?
Assuming that comment is correct, you won't be able to use MFC on GCC compilers. And because Dev-C++ uses these, you won't be able to use MFC in combination with Dev-C++ either. As an alternative, you could try out a free version of MS Visual Studio to be able to use the headers.

Related

How to get error.h in visual studio or equivalent?

I have large C++ project that I inherited and am trying to transfer it from Linux to Visual Studio on Windows. Managed to link required libraries, but one build error just baffles me.
In Linux, someone was including a header <error.h> everywhere, and I can't even find a documentation page to see what it is. First I thought is part of standard library, but I am now beginning to see it's a specific header for Linux OS.
So, how do I include it in Visual studio? I can't even find what it is and am tempted to just rearrange code to use stdexcept header, as the only thing these codes do is abort compilation and printout error messages by using some error(...) function from error.h.
error.h is a header from the GNU C Library. It is not specific to Linux, it is specific to glibc.
It is documented right here (search on the page for error.h).
The functions declared in error.h should not be used in portable code, so getting rid of code that uses them is not a bad idea. Alternatively, it is not difficult to implement them.

Dev-C++ cannot find <iostream> or <iostream.h> header files

Dev-C++ cannot find the I/O stream header files. I tried it with both #include <iostream> and #include <iostream.h> but I get the following errors.
[Error] iostream.h: No such file or directory
[Error] iostream: No such file or directory
What can I check in the Dev-C++ settings to make sure it's properly configured to build programs that use the C++ Standard Library?
#include <iostream>
You've got a double 's' in your code as far as I can see and that may be causing a problem. If including "iostream" header file won't work as well it means that your Dev-C++ (sic!) is probably not linked with MinGW properly.
As the others said, consider using f.e. Code::Blocks instead Dev-C++.
If you didn't download the Dev C++ that includes MinGW then you don't have the standard libraries. If you do have the standard libraries you will need to make sure to set it up by pointing it to the location of the source on your system.
If you still need the standard libraries, you can go to "Downloads" section of this page and go to the first link which includes MinGW.
But your best bet is to send Dev C++ off to die in a fire. The incredibly powerful Visual Studio 2015 is out and the Community version is free: https://www.visualstudio.com/downloads/download-visual-studio-vs There's really no excuse for using anything else on Windows.

TR1 is "missing" - which header or library am I missing from my project configuration?

I'm attempting to use some types from TR1/functional. I have the following reference in my header file:
#include <tr1/functional>
This is resulting in an error:
C1083: Cannot open include file: 'tr1/functional': No such file or
directory.
This has always worked before. I've been browsing MSDN trying to determine if I'm missing a library reference or something of the sort, but for the life of me I'm unable to find out what is wrong with my project configuration.
I'm using C++11 and working in Visual Studio 2013 Developer Preview.
The <tr1/*> headers should have been deprecated or removed following their inclusion in the standard. So they're mostly there for older compilers such as VS2010 or VS2008. Including <functional> alone should fix it.
A couple things to note though, although I do not know if it applies to VS2013 is that std::regex's include is <regex> yet still resides in the old std::tr1 namespace.
I am also using VS 2013 and faced same problem. After few research, finaly I got it working using Boost. It is prety well supported.

How can I use the old iostream.h in C++ (Visual Studio 2010)

I have a Microsoft Visual C++ 6.0 Project and converted it successfully with MS VS Professional 2010 Trial. No conversion problems occured. However, when building the converted project it tells me, that "iostream.h" cannot be found.
I am aware of the new and standardized "iostream" and the "using namespace std" fix.
But I need to use the old iostream.h. Is there a way to accomplish that? The reason is, that this project relies on an old static lib using the old iostream.h.
Any suggestions?
If you have source code relying on iostream.h, change it.
If you have source code that you absolutely cannot change, write iostream.h yourself:
#include <iostream>
using namespace std;
A static library cannot possibly rely on a header file. A header file is included by source code or other header files, the static library consists of object code. The library's header files can depend on iostream.h, though.
The library itself can depend on the C++ standard library.
I assume that there have been incompatible changes to Microsoft's standard library since MSVC 6.0, so if you do not have source code or a newer version of your static library, then you are probably out of luck.
Are you using precompiled headers? If so, then you'll have to include iostream.h within the stdafx.hfile or remove the precompiled headers. Anyway, there seems no reason using the deprecated iostream.h instead of iostream, so maybe you should change the parts of the code that need the old version (if so).
Replace
#include <iostream.h>
with
using namespace std;
#include <iostream>

cannot open source file "stdafx.h"

I have two include file headers
#include "stdafx.h"
#include "psapi.h"
However it gives a cannot open source file "stdafx.h" compile time error. I am using Visual Studios 2010. Is "stdafx.h" even necessary? I think so because the program cannot compile if i take it away.
Visual Studio uses it for "precompiled headers" feature. If you are not experienced with Visual Studio, I would recommend to keep the stdafx.h in the project.
And of course, if you #include it, you ought to have it.
stdafx.h is used for precompiled headers. It is not necessary, but disabling the compiler feature can be a little tricky if you have never done it before. If you have it, then you must compile 'stdafx.cpp' before compiling anything else.