Compilation error of Variable Length Array with GCC
How to make a compilation successful for a program with a variable length array?(currently, Showing error : Variable sized array). I am using gcc in linux. How to make compiler compatible to c99...
View Articlelearning sample of likely() and unlikely() compiler hints
How can I demonstrate for students the usability of likely and unlikely compiler hints (__builtin_expect)?Can you write an sample code, which will be several times faster with these hints comparing the...
View ArticleWhy am i getting this "no declaration matches" error?
EDIT: I have realised that this strange error is due to me not fully understanding the text editing software i used and it not fully saving my files when i thought it did in some strange ways. my code...
View ArticleHow do I resolve this error 'cannot find -lc'?
How do I compile this code in CentOS 7 ? I am reading one book and in the book they use -static while compiling so that's how I did it and I get errors I mentioned below but when I dont use -static I...
View ArticleCygwin Not Showing Any Output in C
I wrote this code in Sublime:int main (int argc, char **argv){ printf("Hello World"); return 0;}Saved it at C:\cygwin64\home\debol as helloworld.c.Typed in this on Cygwin64 Terminal:$ gcc -o helloworld...
View ArticleC: Weird label behavior with -O3?
Given this code (minimal example; there's no deeper meaning in it):#include <stdio.h>int main() { start: asm volatile(".code64\n\t""push %rax\n\t""pop %rax" ); end: printf("%ld\n", (const char...
View ArticleWhat happens with address of operator for variables that the compiler decides...
I understand that in C, if a variable is explicitly specified with the register keyword, then one cannot use the & operator on it, and that makes sense to me that there's no such thing as "address"...
View ArticleVS2017 Cross platform project does not set C++17 as language standard
Am using VS 2017 v.15.9 to develop a cross platform application. Target system has GCC v 8+ installed on it, which, according to documentation, supports C++ 17.For some reason though, the c++ language...
View Articlestdint.h include_next'd from stdint.h not found
I have been putting together a m68k cross compile "environment/toolchain" of sorts for some upcoming projects I have planned, and I'm having an issue when using it on macOS (my native environment)...
View ArticleGCC Version 10.1.0 failing on compilation of a BUILT IN function call in LFS...
My build is frozen this is figured out.I'm using jhalfs to get started but the issue is most certainly gcc-10.1.0I get the following error in the make log. The error outwardly says this a gcc thing......
View ArticleA "how is it finding libpython?!" puzzle
I'm trying to get a semi-abandoned python scientific computing package written for python 2 to compile against python 3. My problem has to do with the linker not being able to find libpython. It's...
View ArticleWhat is the best way to boilerplate the "cold/never_inline" error handling...
In this article, a technique is described to move error code out-of-line in gcc to help optimise the hot path for size as much as possible. An example of this would be:#define unlikely(x)...
View ArticleUsing google mock for C code
I'm maintaining a legacy project written in C and it's unfeasible to get it running with a C++ compiler. Since the code is cross compiled it is however possible to run unit-tests or similar in a host...
View ArticleBuilding executables from open-source library for portability (Festival TTS)
I'm working on a Python/C++ application that will run on Mac OS and relies on the Festival Speech Synthesis System, which I'm building from source here. In my project, I use Festival's shell-based API...
View ArticleUnderstanding std::pow Implementation in GCC
I am trying to understand how the std::pow function works in GCC. I was looking at the source code for the cmath library here...
View Articlewhat does the first m in -masm mean?
I'm new to gcc, just a question on gcc -masm, I know that by using masm we can elect the (dis-)assembly dialect from ATT(default), to Intel. And -masm is a GNU option and has nothing to do with...
View ArticleWhy do gcc and clang generate different symbol names for an instantiation of...
Consider the following example:struct A { using type = int;};template <typename T>using B = A;template <typename T>typename B<T>::type f() { return {}; }template B<int>::type...
View ArticleCompiling an application for use in highly radioactive environments
We are compiling an embedded C/C++ application that is deployed in a shielded device in an environment bombarded with ionizing radiation. We are using GCC and cross-compiling for ARM. When deployed,...
View ArticleEclipse with cmake4eclipse: Editor does not recognize symbols defined in...
Windows 10 Version 1809Eclipse IDE for C/C++ Developers (Version: 2019-06 (4.12.0))cmake4eclipse 2.1.1cmake version 3.17.0GNU Make 4.2.1repository for a simple example project:...
View ArticleWhy c++ program generating different output for the same input? [duplicate]
I am implementing matrix chain multiplication program in c++. I am using ONLINE_JUDGE flag to write output to the file. When i run the program it does not produce correct output in file, but it is...
View Article