clang++

clang++ 3.2 with libstdc++-6.dll on Windows 7 (32 bit)

大城市里の小女人 提交于 2019-12-14 04:06:38
问题 After searching alot at Stackoverflow and Googling out my problem, I still can't run an .EXE file build using clang++ 3.2. "clang++" gives out no error when compiling .BC file into .EXE. The moment I try to run the .EXE file, it suddenly terminates the program. Can anyone help me with this? I've already tried to use -static-libstdc++-6/libstdc++, but the problem remains. Side note : executables made using g++ compile without any problem and run fine. EDITED : My code: #include <iostream>

Function boundary identification using libclang

有些话、适合烂在心里 提交于 2019-12-14 03:52:48
问题 I am learning to parse C++ files using Python + libclang with the help of this very informative (but slightly outdated) tutorial by Eli Bendersky. My objective is to parse C++ files and identify the function boundaries for functions present in those file. I am expecting to build a python dictionary of this form: {<func_name>:(<func_start_loc>, <func_end_loc>), ...} To this end, I am able to get the function name (using cursor.spelling for AST nodes that are of CursorKind.FUNCTION_DECL or

Clang++ -fmodules errors using types after #include <cstdint>

萝らか妹 提交于 2019-12-13 13:16:49
问题 The following simple test case file is giving me a compile-time error with the tip of 'master' from Clang's github mirror, when compiled with -fmodules , using the command shown below. I'm wondering if this is a bug with the new experimental Module feature for Clang -- maybe a problem with the implementation of module maps for the standard library -- or if there's something I'm doing wrong. The error still appears if I add -fbuiltin-module-map to the command. Interestingly, the error no

How to specify type of a constexpr function returning a class (without resorting to auto keyword)

a 夏天 提交于 2019-12-13 09:56:06
问题 Basically in below I want to see if I can get around having to use auto keyword Suppose that we have the following piece of code [works with g++ 4.9.2 (Ubuntu 4.9.2-10ubuntu13) & clang version 3.6.0] : //g++ -std=c++14 test.cpp //test.cpp #include <iostream> using namespace std; template<typename T> constexpr auto create() { class test { public: int i; virtual int get(){ return 123; } } r; return r; } auto v = create<int>(); int main(void){ cout<<v.get()<<endl; } How can I specify the type of

Convert std::filebuf(FILE*) to use libc++

独自空忆成欢 提交于 2019-12-13 05:12:25
问题 I have some existing code that I am trying to compile using clang 3.3 and libc++ from llvm.org. A simple step to retrieve the result of another command. It appears that std::filebuf doesn't offer a FILE* constructor any more and all the ideas that I have tried to replace the code have all failed to open the command, that is fb.is_open() always returns false. From what I can find I would have to use something like fb.open(cppcommand.c_str(), std::ios::in); instead of popen. The essential parts

type_traits file not found (Xcode 5)

蓝咒 提交于 2019-12-12 20:32:02
问题 i'm trying to build an application that uses wxWidgets library. but i get a preprocessor error that says 'type_traits file not found'. i've followed the answers in the questions XCode 4.5 'tr1/type_traits' file not found and Xcode 4.3 and C++11 include paths but i'm still unable to resolve that error. how to configure xcode to include the type_traits file? EDIT : i figured it out. libc++ needs deployment target >= OS X 10.7 来源: https://stackoverflow.com/questions/22855113/type-traits-file-not

C++ 11 code compiles with `clang++`, but not with `clang -x c++`

独自空忆成欢 提交于 2019-12-12 11:03:55
问题 Basic Problem I have the following code #include <iostream> #include <cstdint> using namespace std; int main () { int32_t spam; spam=5; cout << "Hello World! We like " << spam << endl; return 0; } This compiles nicely when I do clang++ -stdlib=libc++ cpptest.cpp . However, the otherwise excellent SublimeClang parser for Sublime Text 2 doesn't seem to understand it. I figured that might be because it uses clang -x c++ instead of clang++ , and tried to compile my snippet above using clang -x c+

Clang++ --gcc-toolchain and gcc 4.9.3 linking issues

随声附和 提交于 2019-12-12 10:57:18
问题 (Ubuntu 16.04.1) By default on 16.04.1 clang is picking the gcc tool chain for 5.4. Unfortunately I have a library that requires pre-5.0 ABI and I do NOT have access to the source, nor has the implementer released a new version. I've been trying to use the --gcc-toolchain option, but I can NOT get it to work. (ctrbegin.o and crtend.o don't get the proper prefix at link.) $ clang++-3.8 -v -print-search-dirs clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final) Target: x86_64-pc-linux-gnu

“no viable conversion” with lemon for clang but valid for g++

白昼怎懂夜的黑 提交于 2019-12-12 09:08:55
问题 Currently, I try to incorporate lemon library in our project. Most developers are on Windows, they compile with MSVC, but I am in charge (for this part) to compile with gcc and clang. I came across an error with clang that gcc does not reproduce and I managed to reduce the code: #include <lemon/dfs.h> int main() { lemon::ListDigraph g{}; lemon::ListDigraph::Node node = g.nodeFromId(42); lemon::Dfs<lemon::ListDigraph> dfs{g}; lemon::SimplePath<lemon::ListDigraph> path = dfs.path(node); return

Why does GCC optimization not work with valarrays?

空扰寡人 提交于 2019-12-12 07:47:14
问题 This is a simple c++ program using valarrays: #include <iostream> #include <valarray> int main() { using ratios_t = std::valarray<float>; ratios_t a{0.5, 1, 2}; const auto& res ( ratios_t::value_type(256) / a ); for(const auto& r : ratios_t{res}) std::cout << r << " " << std::endl; return 0; } If I compile and run it like this: g++ -O0 main.cpp && ./a.out The output is as expected: 512 256 128 However, if I compile and run it like this: g++ -O3 main.cpp && ./a.out The output is: 0 0 0 Same