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

This question already has answers here:
Is MFC only available with Visual Studio, and not Visual C++ Express?
(2 answers)
Closed 9 years ago.
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.

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.

In addition to the IEEE "student membership" option that someone else linked to, you may want to consider Microsoft's BizSpark program which will give you access to more than just Visual Studio. I do not know if you qualify for it, but it's worth looking into.
With that said, it's time to step onto the soapbox and add some commentary: I understand the problem of API of choice having a dependency on MFC, but realistically speaking developing a trading program is neither particularly easy nor a good place for you to start. In addition, starting with MFC is probably not a good idea unless you want to specifically focus on becoming an MFC developer. If you are set on C++ you would be better served focusing your efforts on learning C++11. Or at least learning it first. Once you are comfortable with that, then you can focus on learning GUI programming using any of the many frameworks available.
Just my $0.02.

Related

which type of component can be used in Visual C++

at this site
www.codejock.com
there are 2 suite, codejock suite pro and codejock toolkit pro; I want know if extreme suite pro can be used also in visual c++ project or only in visual basic 6 project; I know that there many type of component for visual c++ such as clr, atl, mfc, classic header .h but don't know the difference. Moreover, in many thread of stackoverflow, there are user that have asked of import of ocx control in visual c++ project. can you clarify me this doubts?
If you are going to write in Visual C++ and especially MFC, use the Extreme Toolkit Pro. They also bundle it into smaller packages if you only need some components.

Creating a portable, cross-platform, open-source C++ GUI application that works out of the box?

I've been looking around to see how I'd accomplish that which is described in the title. That is, I'd like to create a C++ GUI application that:
is portable (no installer)
is cross-platform (Qt solves this)
is open source
works out of the box (i.e. no C++ redistributable installs needed)
I've run into several issues trying to accomplish this. I've narrowed it down to using Qt and NOT using the Visual Studio compiler. Let me explain.
Using Qt would fulfill the cross-platform requirement; it's also highly acclaimed in regard to C++ GUI applications. The issue lies with portability and not having a ton of dependency packages to install before being able to use the application. My goal would be for someone to download a .zip file containing an .exe (and I'd be willing to include other support files e.g. DLLs if necessary) and be able to extract and run that exe out of the box without having to do anything else.
And here's another kicker: as much as I'd like to use Visual Studio (with the Qt Visual Studio Add-in), it just doesn't seem feasible given my requirements. This post covers my issues pretty nicely. Simply put, if I use the Visual Studio compiler, I'd need to either create an installer (no longer a portable app), redistribute some Microsoft DLLs with the app (possible licensing and redist issues here?), or statically link the Visual C++ libraries into the executable (frowned upon technique).
Is there any way to be able to use Visual Studio and fulfill the requirements listed above? Visual Studio is just too fully-featured to pass up. If it's not possible, I think the only other alternatives would be to use a different IDE and/or compiler. For example, I could use QtCreator with MinGW, but then I'd be losing out on some awesome VS debugging features.
My main questions:
Is there any way I can fulfill the requirements above and still use Visual Studio?
Am I wrong about QtCreator not being as fully functional as Visual Studio?
What would be the best way to approach fulfilling my application requirements?
Thanks in advance.
I think your best bet would be to use QT with the MinGW environment. It allows you to create a portable application that supplies runtime DLLs by itself, with added bonus of being completely open source. The QT online installer gives you the option to install the complete MinGW system, and it will work out of the box, not much setup needed.
You could still use Visual Studio for development; there even is a QT plugin for it (I am not sure if VS2015 is supported, but if not that should only take some time).
QTCreator is actually a quite nice IDE, but it cannot stand up to Visual Studio. It is obviously optimized to cater to the needs of QT programmers, but I found that it is quite clunky from time to time. If your project is small it could be a viable choice, but since Visual Studio 2015 Community is basically free I would opt for that. The VS plugin will still use QTCreator's GUI editor though (which is really good)

New ATL COM project in Visual C++ 2010 Express: Missing Template

I have a feeling that this is a pretty silly and basic question, but I've been struggling with this for a tad too long today. I am attempting to make a shell extension for Windows following this guide (as well as several others that I have stumbled upon, but that one is the most notable). The issue is that they all start off saying "Run the AppWizard and make a new ATL COM program." However, these are the only project wizards I have in my Visual C++ 2010 Express.
Where can I find this magic project template? Even Microsoft seems to think I should already have it.
AFAIK frameworks MFC, ATL possibly others are not part of the Express edition, to have them you need one of the non-free versions. but there are some interesting links

Using a pure C++ compiler versus Visual C++

I searched around for the answers to these questions, but I have had little luck. So, I thought I would post them here to get some clarification. If this is a duplicate, please let me know, and I will close this.
Okay, with that said, I would like to begin learning C++. I come from a C# background and I have a great respect for Visual Studio and what it can do. Now, my question is. How well does Visual Studio's compiler work for C++ as opposed to a non-Microsoft version (such as MinGW)?
My thing is this. I have nothing wrong with Microsoft, but I would really like to learn C++ in a "pure" form and not scewed by any particular implementation. How reliant is Visual C++ on the .NET Framework? Can a "pure" C++ application be created through Visual Studio without any .NET usage or overhead? Does the Visual Studio compiler compile C++ into CIL like it does with C#/VB, or does it compile it all the way down as others do?
Thanks for any help anyone can provide!
The Visual C++ compiler will compile C++ code into standalone EXEs that have nothing to do with the .NET framework.
The only way to get the .NET baggage thrown in is to compile the C++ as "managed".
If you create a new project (File|New|New Project) Then choose "Win32" from the Visual C++ submenu in the project types and choose "Win32 Console Application" Visual studio will create a simple project with a couple of source files that will compile to a little executable.
Most of the time, Visual C++ is very similar to other compilers. Avoid #pragmas, microsoft libraries (MFC, ATL) and you should be fine.
Edit (thanks Cheeso) - Documentation of where Visual C++ diverges from standard.
In general I would advise using boost libraries for threads and networking because they work on many platforms (i.e linux). Also if your code can compile in GCC and Visual Studio then you are doing a good job keeping it portable.
The most recent versions of VC++ have become significantly more compliant to the C++ standard, so it's not really an issue to write "pure" C++ using Visual Studio, presuming that you stay out of the Windows API, COM+ and ATL. In fact, the documentation with Visual Studio is very rich, with details on the standard libraries and the STL, so it can help you learn a great deal. It can't teach you everything, but it's certainly loaded up with a wealth of information that is portable to any compiler and it is very easily accessbible inside the IDE.
If you create a new solution you should choose new Win32 Project, or Win32 Console Application, and check the 'Empty Project' option. Then you can add a main.cpp file, and add your standard C++ code.
If you like Visual Studio, go ahead and use it to learn C++ -- I haven't used the very latest version, but even the previous one was pretty standards-compliant, C++-wise, and I assume the latest one can only have gotten better. You can have many different kinds of project in Visual Studio, including "console apps", which are the "plain vanilla" kind you could make on any platform, and also many other kinds, such as, windows apps using the good old win32 api, ones made with MFC or other frameworks older than .NET, .NET ones using "managed code", etc.
Just make sure you always work in a "console app" project, and you'll be operating pretty closely to how you would be on other platforms and/or with other C++ IDEs.
If you limit yourself to writing ANSI C++ compliant code then what you write in VS will work in other compilers, until you have to interact with a graphic interface or IO. Then you need to make certain that you are using something that is portable, such as OpenGL, and not DirectX.
To set your project the steps here may be useful:
http://bytes.com/topic/net/answers/447572-strict-ansi-c
Microsoft Visual Studio 2005 comes with a very good, C++98 standard compliant pure C++ compiler. If you are interested in pure C++, don't forget to disable language extensions in project settings and you are good to go. Nobody is going to force you to use .NET framework, MFC or anyting like that. Just pure core C++ language and C++ standard library.
Of course, just like any other compiler, it has known non-compliance issues, but in general it is, again, surprisingly good. Older versions of their compiler (MS VS 6.0 specifically) suffered from many non-compliance problems and could not even compile its own header files with language extensions disabled. In 2005 version they fixed a lot of these issues.
After creating a standard Win32 project, you can turn up the compliance a bit more. On the project properties sheet, there's a C/C++ category, with a Language entry. This lists a number of cases where VC++ can differ from the standard. Here, you'd want to turn OFF language extensions, and turn ON "wchar_t as built-in type", "for-loop conformance" and "RTTI support".

C/C++ Programming in Vista [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
I'm from a Java school, but I'd like to get my hands dirty in C/C++ development as well. Can you suggest:
a Lightweight beginner IDE [Eg: JCreator for Java] (Simple and small download)
a full-blown advanced IDE [Eg: Eclipse for Java] (Every feature and huge download)
should I use GCC or other compilers?
Thanks a lot guys!
1) a Lightweight beginner IDE [Eg: JCreator for Java] (Simple and small download)
Eclipse with CDT (~40 MB download) or Visual Studio 2008 Express edition (2.6 MB download for installer and then tons of stuff that it'll pull from the net) -- it's free. Also, get the SP1. But, I still suggest that you take a look at Visual Studio.
2) a full-blown advanced IDE [Eg: Eclipse for Java] (Every feature and huge download)
Eclipse with CDT (~40 MB download) or Visual Studio 2008 Professional (if you are going to pay).
3) should I use GCC or other compilers?
Yes and no. Depends on your needs. GNU g++ is great to get started with. However, hooking up with CDT may prove to be difficult.
If you intend to do professional Windows programming in near future, it is best to buy the Visual Studio 2008 Pro (and install SP1) and get used to it.
If you have to do it in Vista and if it is Microsoft platform-specific, then there is no better full-blown IDE than Visual Studio. You can download Visual Studio Express Edition for C++ development as a lighter IDE (Not that light though but it is free). Eclipse with GCC works great as well if you want to go cross-platform.
I suggest Code::Blocks. Remember to download the codeblocks-8.02mingw-setup.exe, it includes the GCC compiler and GDB debugger. With it you're ready to start :)
I agree that there is no better Windows IDE for C++ development than Visual Studio. Apart from the free Visual Studio Express, you might also want to consider Visual Studio Standard. It costs about $200 in the US and, among other advantages, allows you to use third-party plugins such as Visual Assist. Those will help you speed up your development even further.
For really light weight, you can go without any IDE. Grab Cygwin, install GCC and start writing code in any text editor (E.g. Crimson Editor). In fact, I suggest you try this to get an idea of how C++ programs are actually compiled behind the scene of an IDE.
You can get Visual Studio Express C++, which is a good package for a beginner. Probably easiest to get started with this.
You can get Eclipse with CDT and use the Cygwin GCC tools, but this is inferior to Visual Studio in certain ways.
Then there's CodeBlock, which I've heard good things about, but don't know how it compares to Visual Studio or Eclipse/CDT.
Do you want to just learn C++ or use C++ to interact with Vista components? The title of your question says Vista but your description is asking which IDE to use.
I agree using Visual Studio C++ Express is a great place to start. It will basically give you the foundation for writing Windows Apps with C++. You said you're from the JAVA world and if you have experience with C# or VB.NET, don't expect all the designers and wizards to be here in C++. Anyone who had done C++ GUI work knows that this isn't always the case. Not to discourage you, there are designers, just not for everything.
If you want to learn how to interact with Windows through C++, the VC++ main site is here, and the how-do-i videos here, also download the feature pack if you haven't installed SP1 yet is here, besides ribbonizing MFC, they've included Boost in the STL, which is awesome. And finally, the guided tours are here.
Also, you don't technically need MFC to write GUI applications, you can call Win32 API functions directly, but MFC is a foundation and will help.
That should get your started. If you need more help, just post a comment.
I agree with the posters above. For microsoft platform specific development, the Visual Studio environment is by far the best. The express editions are nice, but if I remember correctly, they do't come with the win32 SDK, so you still can't make windows GUI programs with it (officially)...
If all you want is to learn C++, gcc/g++ is a great free compiler and an editor with syntax highlighting should be enough. I find an IDE only adds value for larger projects, for simple test/learning projects and IDE is not that neccessary.
You mentioned that that you know about Eclipse for Java. If you have any experience with Eclipse for Java then you can leverage most of that experience towards your C/C++ development by using Eclipse's CDT ( C/C++ Development Toolkit ) plugin.
I strongly encourage using Eclipse with CDT over using Visual Studio because any time spent learning Visual Studio will be lost if you ever want to do any Linux development.
...
I forgot to mention that Eclipse with CDT has all the important features that full version VS has ( and probably more ) ... but doesn't cost any money.
I am rather partial to the Code Gear (formerly Borland) C++ compiler line which I have been using for years.
They have recently release a free 'community' addition called Turbo Explorer
Netbeans is also very good IDE with many futures in it.