clang++

OS X: ld: library not found for -lstdc++

笑着哭i 提交于 2020-08-27 06:52:21
问题 I'm trying to wrap a Python lib around a C++ lib and distutils is failing for me on OS X. Here are the relevant lines from my setup.py: if sys.platform.startswith("darwin"): extra_compile_args_setting = ["-std=c++1z", "-stdlib=libc++", "-O3"] Here's the relevant output: clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/x/anaconda/include -arch x86_64 -I/Users/x/anaconda/include -arch x86_64 -I../../cpp_client/libsrc -I../..

How a .h file can parse as c++ in ClangTool

梦想与她 提交于 2020-08-10 19:15:26
问题 Base RecursiveASTVisitor If input file is test.cpp it can run to VisitRecordDecl. When I modify file name to test.h it can't . #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Stmt.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/raw_ostream.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" #include "llvm

How a .h file can parse as c++ in ClangTool

北城以北 提交于 2020-08-10 19:15:08
问题 Base RecursiveASTVisitor If input file is test.cpp it can run to VisitRecordDecl. When I modify file name to test.h it can't . #include "clang/AST/ASTConsumer.h" #include "clang/AST/RecursiveASTVisitor.h" #include "clang/AST/Stmt.h" #include "clang/Frontend/CompilerInstance.h" #include "clang/Frontend/FrontendAction.h" #include "clang/Tooling/Tooling.h" #include "llvm/Support/raw_ostream.h" #include "clang/Tooling/CommonOptionsParser.h" #include "clang/Tooling/Tooling.h" #include "llvm

-fno-unwind-tables and -fno-asynchronous-unwind-tables does not work NDK clang++

生来就可爱ヽ(ⅴ<●) 提交于 2020-06-23 14:09:00
问题 I'm compiling my C++ code using clang++ that comes with ndk21. I've set both compiler flags -fno-unwind-tables and -fno-asynchronous-unwind-tables but the number of entries in the unwind table do not reduce. I also checked by setting the opposite -funwind-tables and -fasynchronous-unwind-tables but it doesn't increase either. setting -fno-exceptions does reduce the number of entries slightly which makes me think I'm passing the flags correctly. Does anyone have any idea why this could be the

Clang unable to link files in VS Code

≡放荡痞女 提交于 2020-06-17 14:19:29
问题 I recently started learning C++, and I'm currently trying to test out the header file functionality. I wrote three simple files: headertest.h: #pragma once class Cube { public: double getVolume(); double getSurfaceArea(); void setLength(double length); private: double length_; }; headertest.cpp: #include "headertest.h" double Cube::getVolume() { return length_ * length_ * length_; } double Cube::getSurfaceArea() { return 6 * length_ * length_; } void Cube::setLength(double length) { length_ =

Build shared library with Clang++

柔情痞子 提交于 2020-06-11 05:07:38
问题 I am trying to build a shared library (dll for Windows) using Clang++. I have run the following commands: clang++ -c -o hello.o hello.cpp clang++ -shared -v -o hello.dll hello.o The first command works fine but when I try to build the dll I get this error: clang version 3.2 (tags/RELEASE_32/final) Target: i686-pc-mingw32 Thread model: posix "c:/MinGW/bin/g++.exe" -shared -v -m32 -o worker.dll worker.o Using built-in specs. COLLECT_GCC=c:/MinGW/bin/g++.exe COLLECT_LTO_WRAPPER=c:/mingw/bin/..

How to fix “fatal error: 'iostream' file not found” after upgrading to Xcode 10.1

*爱你&永不变心* 提交于 2020-05-28 12:02:13
问题 This error has only appeared for me since updating Xcode (and to MacOS Mojave 10.14). Something similar happened with #include <Python> , which I fixed by instead using #include "python2.7/Python.h". There is a similar error discussed in Clang doesn't see basic headers. When I try clang++ -stdlib=libc++ PyTrans.cpp -o -v I get ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) . The full error: warning: include path

Why do c and c++ treat redefinitions of uninitialised variables differently?

本小妞迷上赌 提交于 2020-05-15 02:57:06
问题 int a; int a=3; //error as cpp compiled with clang++-7 compiler but not as C compiled with clang-7; int main() { } For C, the compiler seems to merge these symbols into one global symbol but for C++ it is an error. Demo file1: int a = 2; file2: #include<stdio.h> int a; int main() { printf("%d", a); //2 } As C files compiled with clang-7, the linker does not produce an error and I assume it converts the uninitialised global symbol 'a' to an extern symbol (treating it as if it were compiled as

CLion 2017.3 unable to autocomplete through unique_ptr using clang 5 (works with 4.0.1)

妖精的绣舞 提交于 2020-05-14 12:33:49
问题 edit: scroll to bold section below for current status. CLion seems to be unable to autocomplete members of a type pointed to by a unique_ptr in clang 5. I either get "no suggestions" or I get suggestions for member functions on the unique_ptr itself: However, with 4.0.1, everything works fine: I also noticed that if I ask CLion to jump to the definition of the -> on c-> , in 4.0.1 it finds it: _LIBCPP_INLINE_VISIBILITY pointer operator->() const _NOEXCEPT {return __ptr_.first();} But in 5.0.0

May I declare a member type alias to a type in a surrounding scope, using the same name?

江枫思渺然 提交于 2020-04-29 08:17:28
问题 I want a struct to contain a type alias to another type for metaprogramming purposes: struct Foo {}; struct WithNestedTypeAlias { using Foo = Foo; }; Then I can do stuff like WithNestedTypeAlias::Foo in a template etc. As I understand, this type alias is valid because it does not change the meaning of the Foo type. Clang compiles this happily. However, GCC complains: test-shadow-alias.cpp:4:20: error: declaration of ‘using Foo = struct Foo’ [-fpermissive] using Foo = Foo; ^ test-shadow-alias