View Full Version : Header not recognized by QT

28th April 2013, 01:54
I'm having an issue with QT where a header is not recognized. The screenshot below best illustrates my issue. Even though QT recognizes it, when I click run, it gives me an error saying there is no header file. What could be the reason for this?

I was making this application for a couple days and the header was always recognized. I ended up doing a qmake and added an additional argument -d which, when the application was run, caused infinite errors. I say infinite because I saw the red circle keep going up from 1 to 50-60 before my QT froze and I ctrl-alt-deleted out of there. When I went back into my project, all of a sudden my StdAfx.h header file is not recognized. This is extremely odd to me. I've spent half the day trying to figure it out, uninstalling QT, uninstalling VS, and reinstalling both. etc etc.

Along with this header not being found, I also got the error below so I suspect that the main issue may be related. Has anyone ever gone through this issue? Even when I created a new project now and added the file StdAfx.h to the project it was not recognized. I've even tried creating a new header file and just copying the code from StdAfx.h to that new header file in case the original was corrupt. No luck. As shown in the screenshot StdAfx.h is in the shared folder.

#error : Building MFC application with /MD[d] (CRT dll version) requires MFC shared dll version. Please #define _AFXDLL or do not use /MD[d]


#ifndef DLLEXP
#define DLLEXP __declspec( dllexport )

#ifdef _MSC_VER

#define assert ASSERT
#define snprintf _snprintf

#include <afxwin.h>


.pro file has the below snippet

INCLUDEPATH += $$PWD/SocketClient
DEPENDPATH += $$PWD/SocketClient

Header not Recognized

28th April 2013, 09:21
"QT" doesn't "recognize" your header file, because Qt is a library that doesn't care about any header files. It is your compiler that cares about the header file and it is the one that can't find it. Possibly because you didn't tell it where to look for it.