Questions tagged [clang++]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
27 views

make: *** [Util/BuildTools/Linux.mk:142: setup] Error 1

I am trying to build Boost for Python in Ubuntu 20.04 and got an error. I am not sure what is the issue. i have clang 10 installed in the system. while trying the following error is coming: Building ...
Rony Shaji's user avatar
-2 votes
0 answers
37 views

Why does the linker not find the symbol? Is my template function incorrect? [duplicate]

I have the following simple code to implement a generic map-functionalty: // in Utils.h #include <iostream> class Utils { public: template <class S, class T> static std::vector<T&...
CocoaNut's user avatar
-1 votes
2 answers
81 views

Overriding a method returning a reference to an array does not work in gcc, but works in clang/icx

I want to return a reference to an array in C++. I am referring to the getColor2 member function and its overrides in the example below. I have a pure virtual member function in my base class ILed: [[...
Igor's user avatar
  • 1,589
0 votes
0 answers
109 views

Why such a different compilers behavior?

The code below provides completely different results with different compilers and environments. With the Visual Studio 2022 (recent version, x64 compiler v19.37) it compiles just fine and outputs the ...
Damir Tenishev's user avatar
2 votes
2 answers
78 views

MacOS std::chrono::clock_cast not found

I am trying to use the new C++20 chrono library, more specifically the new clock_cast. If I compile on Linux with clang++ 16.0.6 it works as expected. However, if I try to compile on MacOS I encounter ...
Azyrod's user avatar
  • 89
-3 votes
0 answers
55 views

Error when compiling/executing c++ code in Mac [duplicate]

I'm struggling to execute a simple project in C++ using a Macbook (clang++) The files I have: //main.cpp #include "other.h" int main() { MyFunc(); } //other.cpp #include "other.h&...
Diego's user avatar
  • 149
0 votes
0 answers
23 views

Building for macOS-arm64 but attempting to link with file built for unknown-x86_64

I am trying to compile a C++ code on my macbook pro, using clang++. I need to link a library (libcplex.a) to the executable. However, I get the following message: ld: warning: ignoring file /. . . ...
Amin AK's user avatar
0 votes
0 answers
66 views

Alias declaration error in C++ compilation

I am trying to compile a C++ code on my Mac OS (Ventura 13.3). When I try to compile the C++ code using the make command, it throws an error that is typically sent as a warning. Some solutions I found ...
cr_007's user avatar
  • 41
-1 votes
0 answers
71 views

How do I configure clang to use clang version of the standard library via CMake? [duplicate]

I am compiling a large C++ project with clang 16.0.4. I have a docker image that sets up a clean development environment. When I compile the code on that image everything goes smoothly. I think this ...
Elad Maimoni's user avatar
  • 3,831
0 votes
0 answers
66 views

Why do these c++ coroutines correctly optimize away in one case but not the other?

I have this a set of coroutines (generators) that I call from func1 and func2. The question is: While the compiler correctly optimizes away the coroutines in func1, producing a constant, why does it ...
user5406764's user avatar
  • 1,673
-1 votes
0 answers
44 views

clang++ stringifying(#) ang concatenating(##) problem

I have that block if code. #define EVENT_CLASS_TYPE(type) static EventType GetStaticType() { return EventType::##type; }\ virtual EventType GetEventType() const ...
Waldemar _'s user avatar
0 votes
0 answers
9 views

error: no matching function for call to 'MH_CreateHookApi'

#include <Windows.h> #include <stdio.h> #include <MinHook.h> //Hook MessageBoxA typedef int(WINAPI* MessageBoxA_t)(HWND, LPCSTR, LPCSTR, UINT); int WINAPI MessageBoxA(HWND hWnd, ...
ThanaKit Thanha's user avatar
2 votes
1 answer
117 views

How to get templates instantiation statistics in clang on Linux?

I'm exploring different aspects of templates in C++ and want to dive into this topic a bit more. For instance, I have a very simple function template in some header file: template<typename T> ...
CurDev's user avatar
  • 39
0 votes
0 answers
31 views

is the difference Register fp and Register sp the stack size? And L1 Data Cache on M1 silicon design

Using LLDB to analyze a C++ program that i wrote. If "STACK" mostly lives on L1 CACHE, is it right to say that the difference between these two registers is a measure of the current stack ...
Cedyangs279's user avatar
1 vote
1 answer
34 views

clang OpenMP loop continues counting beyond loop condition limit

I have the following interesting problem: #include <iostream> #include <omp.h> using namespace std; int main(const int, const char **) { const size_t n = 13; // triggers the issue //...
nh2's user avatar
  • 24.7k
0 votes
0 answers
9 views

CLANG compiler generates an error stating that "the clang compiler does not support 'armv4t-none-unknown-eabi'"

I'm trying to compile using Clang compiler of version V8.1.0. I got a compilation error stating that "the clang compiler does not support 'armv4t-none-unknown-eabi'". 1- I need to know if ...
Mohamad Walid's user avatar
1 vote
1 answer
40 views

My programm is crashes when i compile std::cout using Clang on Windows 10

My app crashes when I compile std::cout using Clang on Windows 10. Clang compile this without warnings or errors. Same problem with mingw-64. #include <iostream> int main(int argc, char* argv[])...
bergemon's user avatar
1 vote
0 answers
31 views

Clang erroneous unneeded-internal-declaration warning?

clang++ (17.0.1) gives a warning for this code: #include <iostream> namespace { void fun () { std::cout << "fun\n"; } } // namespace template<class T> ...
user2052436's user avatar
  • 4,441
0 votes
0 answers
71 views

Simple forward declaration compiles with g++ but not clang

As for a minimally reproducible example, say I have the following class A defined in a header file a.h: // file a.h #include <cstdio> class A { private: int val; public: A(int aVal) { ...
River's user avatar
  • 1
0 votes
1 answer
112 views

CMake + MinGW64 + Clang++ on Windows 10

I would like to compile an application with using Clang++ 10.0, CMake 3.10.1, MinGW x86_64 8.1.0. in Windows 10.I've tried this in the build folder which is in the project folder: cmake ../ -...
c.c's user avatar
  • 11
5 votes
2 answers
112 views

clang 18 and operator overloads from multiple bases

I have upgraded clang from ver 14 to the latest one (18 on trunk) and it seems the only problem I have in my code is operator inheritance from multiple base classes (an example and reference to ...
Konstantin Lazukin's user avatar
2 votes
0 answers
44 views

How to link experimental::simd in clang

I am having trouble linking std::experimental::simd operations in clang++ on MacOS Ventura. Here's my minimal failure: #include <experimental/simd> using std::experimental::simd; int main() { ...
luqui's user avatar
  • 59.8k
-3 votes
1 answer
89 views

Is a undefined behavior for C++ that empty struct with zero-width bit-field tagged align attr?

I have follow wired code. It run failed with clang++, and worked with g++. In aarch64, long long int is 8 bytes, and the struct S94 is 16 bytes(why? Seem in x86-64 is 1 byte). I see https://en....
hstk's user avatar
  • 161
1 vote
0 answers
75 views

Error in compiling CUDA code with clang++ [duplicate]

I am trying to compile cuda (simple hello_world program) code with clang to generate its LLVM IR and subsequently get its call graph using the following command. clang++-13 hello_world.cu --cuda-gpu-...
Tejas Gupta's user avatar
1 vote
0 answers
28 views

Why is it that when the same llvm bitcode is converted to object through clang -c, the resulting binary is not as good as llc

Why is it that when the same llvm bitcode is converted to object through clang -c, the resulting binary is not as good as llc First, post my test steps # 1. generate llvm bitcode clang demo.c -c -O3 -...
zcfh's user avatar
  • 119
3 votes
1 answer
156 views

Why is the explicitly defaulted default constructor implicitly deleted when there is a const std::vector data member?

I've got a code really similar to the snippet below: #include <vector> struct dummy { std::vector<int> const data; dummy() = default; }; Most compilers accept this code without a ...
Oersted's user avatar
  • 1,050
1 vote
0 answers
47 views

Why do .text segments have different addresses and offsets?

An executable program I built with clang, after viewing it with readelf -SW, shows the following [Nr] Name Type Address Off Size ES Flg Lk Inf Al ...... [13]...
Coloda's user avatar
  • 11
0 votes
0 answers
19 views

CppUTest realloc conflict with iostream when compiling with clang++

In my CPP file I have added #include <iostream> But then I get the following error when I compile it: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:2827:22: ...
Lucho's user avatar
  • 1
1 vote
1 answer
111 views

namespace "std" has no member "lexicographical_compare_three_way" on macOS clang

I have been trying to compile this example from cppreference #include <algorithm> #include <cctype> #include <compare> #include <iomanip> #include <iostream> #include <...
Shriram's user avatar
  • 197
3 votes
1 answer
72 views

How to generate function arguments as a sequence with length specified in a template argument

What's a clean way to generalise a template to pass a variable number of arguments (the count given as a template argument) to a function? For example the function permute, below: template<std::...
sh1's user avatar
  • 4,476
0 votes
0 answers
31 views

How to generate sequence diagram from cpp code in windows?

I know that clang-uml can generate cpp code to sequence diagram. But I am unable to use it. I have installed it but some configuration issue occurred. I want to generate sequence code from cpp code. ...
yash jaiswal's user avatar
4 votes
0 answers
77 views

Is there a C++ compiler warning or linting tool that warns when calling a method not defined in a concept constrained type?

For some concept... template<class T> concept can_meow = requires (T t){ t.meow(); }; ... is it possible to get a warning when the following is called? void func(can_meow auto& anim){ ...
Jordan's user avatar
  • 113
1 vote
1 answer
125 views

Getting a lot of Linker errors related to LLVM and clang after built from source code

I have build clang,llvm,lld,openmp targets from the source code of llvm mono repo. I used the following commands: cmake -G "Ninja" -DLLVM_ENABLE_PROJECTS="clang;lld;llvm;openmp" -...
Rajkumar Ananthu's user avatar
0 votes
1 answer
48 views

clang++ error on standard library depending on -std=c++2b version and warning when using -g flag

While compilation with g++ works correctly if I compile with clang++ the command bellow compiles correctly clang++ -std=gnu++20 -c 03_vect.cpp -o Debug/03_vect.cpp.o while the command bellow clang++ -...
George Kourtis's user avatar
0 votes
0 answers
51 views

How do I compile libgit2 for Android

recently I've been working on a flutter app, which uses libgit2 and I had no issues compiling the libgit2 repo for linux. Now, I would like to add support for android, so I tried to compile it using ...
Jakub Slabý's user avatar
0 votes
0 answers
83 views

clang++-17 with -std=c++20 can't find zoned_time in namespace 'std::chrono'

I'm trying to compile the following code: #include <chrono> #include <iostream> int main() { const std::chrono::zoned_time zt{ "Europe/London", std::chrono::system_clock::...
Cherub's user avatar
  • 17
6 votes
1 answer
91 views

Temporary object creation for reference parameter and optimization changes

I have the following code #include <iostream> void foo(const int* const &i_p) { std::cout << &i_p << std::endl; } int main () { int i = 10; int* i_p = &i; ...
User 10482's user avatar
0 votes
0 answers
103 views

Fail compiling boost-1.82.0 using clang-16.0.0 in Windows

I used pacman to install clang-16 on windows 10, then set the path on environment. My target is to build boost 1.82.0 and use both clang and boost to compile a project. Installing clang-16 works fine, ...
meAbab's user avatar
  • 102
0 votes
1 answer
89 views

Why does object have NULL vtable pointer in C++?

I'm using libTooling built from source (git tag: llvmorg-16.0.6) for searching diff of AST level. When using my built product, Segmentation fault occured. Through inspection by gdb, I found that this ...
Mizunashi's user avatar
  • 315
7 votes
1 answer
112 views

How to declare a constructor of template class as friend with clang? (compiles with g++, not clang++)

I have a template class with a private constructor which is to be friends of every typed instance of the class. The following compiles under g++ 11.4.0 but fails under clang++ version 14.0.0-1ubuntu1....
Eric's user avatar
  • 73
0 votes
0 answers
32 views

clang++ error on Chromium Android arm builds with rust files added

I've faced some strange behavior when trying to build Chromium for Android arm arch based on checkout 100.0.4896.127. I've added some rust code and for arm64 arch it builds just fine but if I try to ...
Volodymyr Shalashenko's user avatar
0 votes
1 answer
36 views

Clang can't find .o files when linking in nushell compilation script

I am currently trying to write a build script for a c++ project in Nushell. It's a fairly simple setup, with a library that is built first and then and exe that is build in an other script and linked ...
TOOL's user avatar
  • 92
2 votes
0 answers
17 views

CMake goes into an infinite loop when there are two stand-alone subprojects with two different compilers within the same build [duplicate]

I am new to CMake. What I want to have is two different stand-alone subprojects within one "root" project such that those two subprojects could be built independently. Given that those two ...
ramgorur's user avatar
  • 2,124
0 votes
2 answers
353 views

clang++ compiles unreachable function, g++ doesn't

I saw this meme on Instagram about some C++ code that should not output anything but does. The code is: #include <iostream> int main() { while (1) ; } void unreachable() { std::...
MrKleeblatt's user avatar
1 vote
0 answers
41 views

How do I safely distribute a ninja component build?

Context I am compiling Chromium using autoninja and the is_component_build build flag which quote "links many parts of the build into separate shared libraries to avoid the long link step at the ...
Constantin's user avatar
1 vote
1 answer
71 views

Unable to use to_chars with clang++ on MacOs

I've tried to use g++ and clang++, I've tried various c++ versions with the -std flag. I have tried reading the charconv file to see what the issue may be. I could use some help, I'm really unsure of ...
Adam Bujak's user avatar
3 votes
2 answers
153 views

Why does this simple code not consistently compile?

The following code compiles on g++, clang, and Visual Studio: #define HEX(hex_) 0x##hex_ int main() { return HEX(BadC0de); } as does this modification, using C++14 digit separators: return ...
barnabas's user avatar
  • 105
3 votes
2 answers
106 views

Does c++ require template declarations to be well-formed?

In C++, type checking of function templates is deferred until the template function is called (instantiated). For example template<typename T> int right() { return T::f(); } is legal C++ ...
Serid's user avatar
  • 361
0 votes
0 answers
41 views

Coverage parameters of the clang code coverage function change the code logic?

I have a section of the BUILD.gn file configured as follows: config("test") { cflags = [ "-std=c++17", "-fvisibility=hidden", ] cflags_cc = [ "-...
nothing_hooooo's user avatar
0 votes
0 answers
379 views

clang++ error: unknown type name 'nullptr_t'

I recently got a 2020 Macbook air with Ventura on it. I am trying to run some old C++ and for some reason I cannot get it to run. Even running a simple hello world program throws a ton off issues. I ...
GVB's user avatar
  • 1

1
2 3 4 5
40