My intention is to learn under Windows C++11, and the result is that my visual Studio 2012 is not fully supported, and I am too lazy to install 2013/2015, too big. Company operations also do not allow me to download--, and then I would like to be able to play a GCC in the Windows environment, and then I know a piece, the main idea is to clang GCC dumped a good distance, so I decided to install clang environment to learn, the process still met a few pits ...
-----------------------------------------------------------------------------------------------
Download the latest version of Clang, address: http://www.llvm.org/releases/download.html#3.7.0
Then write the C code for the test and save it as demo1.c
#include <stdio.h>
int Main (intchar *argv[]) {
printf ("Hello world!"
return 0;
}
Use Win + R, switch to the demo1.c directory, and then execute clang--verbose demo1.c will encounter an error
I can't find the stdio.h file, then I searched the internet for a long time, for example, this article
Http://zanedp.blogspot.com/2014/01/clang-cant-find-stdioh-etc.html
I follow the steps in the article prompts to install, and finally found that the error encountered:
ld.exe:unrecognised emulation MODE:I386PEP
Supported Emulations:i386pe
This problem is very headache, Google came out a lot of results, but almost no clue, and finally I found an answer in a mailing list
http://comments.gmane.org/gmane.comp.lib.boost.devel/262947
Lack of stdio.h, download MinGW no problem, the problem is that I am not using 64-bit!
Then I searched for the keyword "MinGW 64", and finally I found the answer: http://mingw-w64.org/doku.php/download
Note that the CPU architecture chooses x86_64, because Clang is also using the schema compiled
After the installation is successful, review the GCC information (you need to add the bin of the GCC installation directory to the environment variable)
If the compilation does not pass (I have encountered), close the current DOS window, and then re-do it again.
Source code for Main.cpp:
#include <iostream>
#include <vector>
int Main ()
{
std::vector<int> Vect {1, 2, 3, 4, 5};
for (Auto& El:vect)
"-" << el << Std::endl;
return 0;
}
The rest of the students are invited to play their own fun it ...
Installation and use of clang under Windows