C++ utf-8 literals in GCC and MSVC
Here i have some simple code:#include <iostream>#include <cstdint> int main() { const unsigned char utf8_string[] = u8"\xA0"; std::cout << std::hex << "Size: "<<...
View Articlemake error, gcc: "make[4]: gcc: permission denied" (Arch Linux)
I encountered a rather strange make error when trying to compile some packages. I am running Arch Linux 5.6.7For instance, when trying to compile R 3.6, I get the following error (full output at the...
View ArticleHow to know my code is running on CPU or GPU?
I am a beginner in OpenACC. I want to speed up my program by using OpenACC in fortran language with GCC compiler. my Code is :Program Test use openacc Implicit None...
View ArticleHow to force std::vector to use move constructor instead of the copy one?
I want to use move semantics in my application, not to copy the data.Here is the code:using namespace std;struct TestData{ TestData(const TestData&) = delete; TestData& operator=(const...
View Articlecompile boost 1.41 with gcc 7.4
I what to use AutoDock Vina on my computer but the only release got exec format error: ./vinaSo I have to compile it from source, which relies on boost 1.41.I used ubuntu on win10, with gcc 7.4. When...
View ArticleIs there a predefine marcro for instructions I can use?
I compile with -march=native. When pclmul is available I want to use a custom function that uses _mm_clmulepi64_si128. Are there predefine macros I can use to detect this?
View ArticleHow to combine gcc flags -o and -MM correctly?
During compilation and linking of a simple program, I encountered a weird behavior of gcc that I cannot explain.This here works perfectly fine for mecc -Wall -c -o obj/main.o src/main.ccc -Wall -c -o...
View ArticleConformingly align void pointer
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0How to align void *referencing entity with no declared type to a cache line size in a conforming way?I'm interested to explain the legitimacy of the common...
View ArticleHow to compile the assembly file in RTEMS project?
In my RTEMS project, I have an assembly file (".S" file).How to compile it with my RTEMS application?I compiled my app with waf script.Need your comment. Thanks
View ArticleForcing GCC to put specific statements in a specific section
I know that a compiler (at least GCC) can be forced to place specific functions in specific sections.For example, consider the function foo.int foo(int a, int b, int c);By rewriting as follows, the...
View ArticleHow to load address of function or label into register in GNU Assembler
I am trying to load the address of 'main' into a register (R10) in the GNU Assembler. I am unable to. Here I what I have and the error message I receive.main: lea main, %r10I also tried the following...
View Articlepip3 fails to install imread - 'gcc' failed with exit status 1
when I do pip3 install imread I get the following error:Collecting imread Using cached imread-0.7.4.tar.gz (151 kB)Requirement already satisfied: numpy in ./Library/Python/3.7/lib/python/site-packages...
View ArticleUsing GCC10 with Qt on KDE Neon 18
I would like to play around with some very new C++20 features. Some of them are supported by GCC10 only. Unfortunately the most current release is GCC9.3 so I need to use the unreleased version of...
View ArticleDesignated Initializer Array in C
I'm trying to initialize an struct array using designated initializer:A[size].from = {[0 ... size - 1] = 0};A[size].to = {[0 ... size - 1] = 0};List.h:typedef struct Buffer{ int from; int...
View ArticleHow to get help on Windows command line for MinGW64, C/C++ language keywords...
I try to get the Windows command line to show MinGW64 online help manual on Windows 10 Pro 64-bit, similar to the command "man command_name" executed in a Linux terminal (which shows verbose online...
View ArticleIterator increment leading to different results in clang and gcc
I encountered a weird issue in the following code snippet, leading to different results.Apple clang (tested with 3.8.0 and 11.0) returns the expected value 10 but gcc (tested with 5.4.0 and 9) returns...
View Articlec++ how to create an aggregate that store lambdas and can be passed to a...
I'm trying to pass an aggregate that stores functions as designated initializers with no success. This is what I tried: typedef struct Handlers { std::function<void()> func1 = nullptr;...
View ArticleUnable to install latest GCC on Windows
I am trying to install GCC on my local system.I am referring thisI have successfully completed the following steps:Install CygwinInstall Required Cygwin Packages C:\cygwin64>setup-x86_64.exe -q -P...
View ArticleForcing latest gcc available with cmake
I am deploying a small application to several different systems (mac, linux, linux64) where it needs to be compiled. I would like to tell cmake to the latest gcc available in a particular system. For...
View ArticleDoes gcc(windows + MinGW) defines SCNd8, SCNu8 in inttypes.h?
#include <stdio.h>#include <inttypes.h>int main(void){ int8_t int8; int16_t int16; int32_t int32; int64_t int64; uint8_t uint8; uint16_t uint16; uint32_t uint32; uint64_t uint64;...
View Article