我正在努力让Clang在Windows上工作,最终使用Qt Creator进行开发,看看它是否是Visual Studio的可行替代品.
我LLVM和3.2锵(SVN版本163238),使用编译MinGW的W64(mingw-w64-bin_i686-mingw_20111220.zip)和还指出,海湾合作委员会的C++头文件目录加入AddMinGWCPlusPlusIncludePaths("D:/Code/mingw/lib/gcc", "x86_64-w64-mingw32", "4.7.0");到clang/lib/Frontend/InitHeaderSearch.cpp,虽然我认为这可能不是最上调迄今为止的方法.无论如何,Clang似乎找到了大部分标题.
但是,在编译简单的Hello World时:
#include <iostream>
int main(int argc, char* argv[])
{
std::cout << "test\n";
return 0;
}
Run Code Online (Sandbox Code Playgroud)
使用clang++ main.cpp我得到这个错误:
In file included from main.cpp:1:
In file included from D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\iostream:39:
In file included from D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\ostream:39:
In file included from D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\ios:39:
In file included from D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\iosfwd:41:
In file included from D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\postypes.h:41:
D:/Code/mingw/lib/gcc/x86_64-w64-ming32/4.7.0./include/c++\cwchar:45:10: fatal error:
'wchar.h' file not found
Run Code Online (Sandbox Code Playgroud)
因此,Clang显然发现了几个C++标题,iostream但未能找到wchar.h.事实证明,这wchar.h是位于.../include/c++\tr1Clang不寻找的地方.将这些TR1标题移到一个目录中也无济于事.
我在这做错了什么?gcc C++库是否与Clang不兼容,因为它显然还没有将一些TR1库集成到标准中?我在哪里可以获得兼容的Clang …
请考虑以下代码:
#include <vector>
#include <boost/noncopyable.hpp>
struct A : private boost::noncopyable
{
A(int num, const std::string& name)
: num(num),
name(name)
{
}
A(A&& other)
: num(other.num),
name(std::move(other.name))
{
}
int num;
std::string name;
};
std::vector<A> getVec()
{
std::vector<A> vec;
vec.emplace_back(A(3, "foo"));
// vec.emplace_back(3, "foo"); not available yet in VS10?
return vec; // error, copy ctor inaccessible
}
int main ( int argc, char* argv[] )
{
// should call std::vector::vector(std::vector&& other)
std::vector<A> vec = getVec();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
这并不在VS2010编译,因为很明显A是 …
由于某种原因,我的fakeAsync测试不会解决简单的承诺。我创建了一个显示问题的最小示例(主要是ng生成的样板文件)。
我的被测组件在其方法中包含一个简单的直接承诺解析ngOnInit:
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-simple-test',
templateUrl: './simple-test.component.html',
styleUrls: ['./simple-test.component.scss']
})
export class SimpleTestComponent implements OnInit {
constructor() { }
message: string;
ngOnInit() {
Promise.resolve('hello').then((content: string) => this.message = content);
}
}
Run Code Online (Sandbox Code Playgroud)
我正在通过以下测试来测试这个承诺:
import { async, ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
import { SimpleTestComponent } from './simple-test.component';
describe('SimpleTestComponent', () => {
let component: SimpleTestComponent;
let fixture: ComponentFixture<SimpleTestComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ SimpleTestComponent ]
}) …Run Code Online (Sandbox Code Playgroud) c++ ×2
c++11 ×2
angular ×1
clang ×1
jasmine ×1
mingw ×1
testing ×1
typescript ×1
visual-c++ ×1
windows ×1