locked
afxwin.h and mfc - what do I need to use 'em? RRS feed

  • Question

  • Hello, I have Visual Studio Premium installed, but when I try to compile a C++ program, I get the error "Cannot open include file: 'afxwin.h': No such file or directory". I've read that this problem occurs when using the Visual C++ Express edition, as MFC is not included in there. Is it possible to compile MFC stuff in my version of Visual Studio and what do I need for that? Here is a list of all crap I have installed right now: http://i43.tinypic.com/256xvsp.jpg Additional: The weird thing is that including it in my Form class produces no errors, but in stdafx.h it does.
    • Edited by midaiganes Monday, February 13, 2012 12:07 PM
    Monday, February 13, 2012 12:04 PM

Answers

  • Since I can not see your picture (it is not attachet here in the forum!) I can only assume. From what you told there is a lot stuff missing.

     My Visual Studio 2010 directory looks completely different. I also have a VC# directory (since C# is also installed). The picture above shows a almoste complete setup of VS2010 with C++, F#, C# and other stuff...

    I recommend startig setup again and install VC++ completely. For soure I'd also install all 64bit stuff for VC++ in case you want to do 64bit builds later.


    • Edited by Bordon Monday, February 13, 2012 12:49 PM
    • Marked as answer by midaiganes Monday, February 13, 2012 1:09 PM
    Monday, February 13, 2012 12:48 PM

All replies

  • Visual Studio Premium has MFC included, therefore you should have everything on board.

    What Visual Studio Version are you using?

    Can you please check if in directory:

    C:\Program Files\<Your VS Version>\VC\atlmfc\include

    if "afxwin.h" is present? Maybe your directory settings are mixed up?


    • Edited by Bordon Monday, February 13, 2012 12:10 PM
    Monday, February 13, 2012 12:09 PM
  • In C:\Program Files\Microsoft Visual Studio 10.0\ I have 2 folders: 'Common7' & 'Team Tools' and no include folder. Most folders called 'include' seem to be in 'C:\Program Files\Microsoft SDKs\Windows\v7.1', however none of them contain afxwin.h
    • Edited by midaiganes Monday, February 13, 2012 12:20 PM
    Monday, February 13, 2012 12:18 PM
  • If you have visual Studio 2010 Professional or above you have a folder

    C:\Program Files\Microsoft Visual Studio 10.0\VC

    if you selected the setup of VC++. for me it seems you did not made a complete setup or you do not have a Visual Studio 2010 professiona or above version installed.

    Could you also please attach you http://i43.tinypic.com/256xvsp.jpg here as image. I do not have access to tinypic.com due to company proxy restrictions.

    Monday, February 13, 2012 12:28 PM
  • I have VS Premium installed, but I believe at install time C++ was not installed, only C#. What steps should I take to fully install it now?


    • Edited by midaiganes Monday, February 13, 2012 1:06 PM added image
    Monday, February 13, 2012 12:34 PM
  • Since I can not see your picture (it is not attachet here in the forum!) I can only assume. From what you told there is a lot stuff missing.

     My Visual Studio 2010 directory looks completely different. I also have a VC# directory (since C# is also installed). The picture above shows a almoste complete setup of VS2010 with C++, F#, C# and other stuff...

    I recommend startig setup again and install VC++ completely. For soure I'd also install all 64bit stuff for VC++ in case you want to do 64bit builds later.


    • Edited by Bordon Monday, February 13, 2012 12:49 PM
    • Marked as answer by midaiganes Monday, February 13, 2012 1:09 PM
    Monday, February 13, 2012 12:48 PM
  • Thank you for your help.

    I'll just install Visual C++ Professional trial and try to complete my program from there. Reinstalling Visual Studio is unfortunately not an option..

    P.S. edited previous post and now you should see the image.

    Monday, February 13, 2012 1:09 PM
  • Maybe you are running Windows 7 64 bits, and the missing files could be
    in c:\program files (x86)\... ?
     
    Monday, February 13, 2012 11:53 PM