Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

MFC app- add variable to dialog error "cannot open include file 'windows.h'"

Posted on 2011-10-17
5
Medium Priority
?
438 Views
Last Modified: 2012-05-12
Hi Experts,

Like the subject says, Visual Studio 2010 can't find my windows.h file when trying to add a variable to my dialog.  I just created this dialog and tried to add a variable to it, but I get the error that VS can't open windows.h.  How can I fix this?

Thanks,
Mike
0
Comment
Question by:thready
  • 2
  • 2
5 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 1000 total points
ID: 36979852
MFC applications are not supposed to directly include "windows.h", the "StdAfx.h" file generated for your project should have a reference to "windows.h"

Apart from that, check your project settings and your INCLUDE environment varaible if anything is wrong...
0
 
LVL 35

Assisted Solution

by:sarabande
sarabande earned 1000 total points
ID: 36980028
do you get that error while designing a dialog with the resource editor or while compiling after you added the variable to your dialog class in yourdialog.h ?

if the latter you should try to build not changing anything in the sources. if you get the same error the installation of vs2010 was wrong or was performed without sufficient access rights.

if you have the problem when you try to add a variable with the wizard it probably is a problem with the include paths in an active-x control or in rc file.

Sara
0
 
LVL 1

Author Comment

by:thready
ID: 36980066
It's while designing the dialog.  But I found the problem - it's been so long and I completely forgot I had a separate dll for the resources (for translation).  I was modifying the resources in my MFC app solution and not in the dll that I load for translation.  Still have not got it working, so I won't close this question right away in case there's still something related to this question.....

Thanks,
Mike
0
 
LVL 35

Expert Comment

by:sarabande
ID: 36980218
a foreign dll used in the dialog editor would evaluate the environment variable include which could/should be properly set via system settings.

you also could check the 'edit' menu for menu item 'resource includes' when in the dialog editor. if there are #include statements the resource editor would need to resolve those files. i currently have no vs2010 available, so i am not sure whether you can add 'additional include folders' in the project settings like you could do until vs2008.

Sara

0
 
LVL 1

Author Closing Comment

by:thready
ID: 36980256
yep, that's what it was, but you guys helped me anyway (great help as usual!), thank you!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

With most software applications trying to cater to multiple user needs nowadays, the focus is to make them as configurable as possible. For e.g., when creating Silverlight applications which will connect to WCF services, the service end point usuall…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question