Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I get afx...h files? [duplicate]

Tags:

c++

mfc

I'm developing with an API and the API requires the afxsock.h among other afx... headers. After searching online, it seems that my VS Express isn't enough, so I looked to purchase the product at microsoft. Unfortunately it's 700$ and as a beginning programmer, it makes no sense for me to drop that on 1 project which I am using to teach myself c++. (I.e. I still don't know if I want to program long term in C++ or another language).

In any case, I was wondering if there was some sort of work around to get the afx (or more appropriately the MFC) files?

Note that I have Windows 8, Visual Studio 2012, and I've downloaded the Windows Development Kit for Windows 8, but still can't compile because I'm getting missing afx errors.

like image 549
Terence Chow Avatar asked Dec 21 '22 06:12

Terence Chow


1 Answers

The AFX prefix stands for Application Framework Extensions, which was the original name for the MFC (Microsoft Foundation Classes) libraries. The file names were set in stone before the name was changed to MFC, and it was too late to change them.

So you need MFC in order to use those headers. Unfortunately, the Express versions of Visual Studio do not include MFC (or ATL). You can only develop MFC applications using the Standard, Professional, or higher editions of Visual Studio.

If you are a student, you have a couple of great options:

  • You can can join Microsoft's DreamSpark program, which is free to students and entitles you to some great free downloads, including VS 2012 Professional, VS 2010 Professional, and recent server versions of Windows.
  • Alternatively, you can join the IEEE for a very low cost. The IEEE student membership entitles you to download many Microsoft tools, including the Ultimate editions of Visual Studio. See this page for more information. (Although that page mention VS 2010, VS 2012 is actually available.)

Otherwise, you will have to either buy Visual Studio Standard/Professional outright, or join MSDN.

Alternatively, you could use the winsock2 API, which is part of the Windows SDK rather than MFC. Get started with the documentation here. The Windows SDK is what you're getting when you downloaded the "Windows Development Kit for Windows 8". It includes everything you need to link to native Win32 libraries, but it does not include the MFC framework.

like image 93
Bull Avatar answered Dec 24 '22 02:12

Bull