Can I use Intel syntax of x86 assembly with GCC?
I want to write a small low level program. For some parts of it I will need to use assembly language, but the rest of the code will be written on C/C++.So, if I will use GCC to mix C/C++ with assembly...
View ArticleIs there a size limit on the length of a std::array?
If I try to instantiate a large two-dimensional std::array on our Centos 7.6 system, compiled with g++ 7.3.1, I get a segmentation fault: int main() { const unsigned NUM_BUFFERS = 200; const unsigned...
View ArticleError with libstdc++ when running python script
When I try to run a python script in the terminal, this error appears when trying to import matplotlib.File "main.py", line 14, in <module> import matplotlib.pyplot as plt ImportError:...
View ArticleC Array Split By Odd Even Indexes Gives Garbage Values
Before anybody flags this as Duplicate, it is not.So I have this arrayint arr[6]; I want to split it into two different arrays based on the indexes. Now this is my program :#include <stdio.h> int...
View ArticleWill GCC optimize away an inline accessor?
Let's say I have this classclass Point { inline float x() const { return v[0]; } inline float y() const { return v[1]; } inline float z() const { return v[2]; } float v[3]; }; And I do:Point myPoint;...
View ArticleHow do I return python style function from within a function in C?
Consider the below python code:# Return a function that returns its argument incremented by 'n' def make_incrementer(n): def increment(x, n=n): return x+n return increment add1 = make_incrementer(1)...
View Articlegcc-fortran missing component libmpfr
I have installed gcc-fortran on arch linux When try to compile a hello world program with gfortran helloWorld.f90, where this file is just Program Hello Print *, "Hello World!" End Program Hello I...
View Articleundefined reference to sqrt in SVM-Struct (have used -lm)
Actually, I am working with the well-known SVM-struct project (http://www.cs.cornell.edu/people/tj/svm_light/svm_struct.html)on Ubuntu 16.04. I followed the instructions in...
View ArticlePass mysql.h path to gcc compiler
I've created a database using mysql, and now i need to connect it with C, basically just to call some functions, already created in SQL.I've installed the "C Connector" from mysql website. When i try...
View ArticleLinux process stack overrun by local variables (stack guarding)
From What is the purpose of the _chkstk() function?: At the end of the stack, there is one guard page mapped as inaccessible memory -- if the program accesses it (because it is trying to use more stack...
View Articleqemu: uncaught target signal 11 (Segmentation fault) - core dumped, when...
I just noticed that I am unable to have a function return a struct. I am running this on ARM32/debian docker image with threads enabled.This is the function that gives me the run time error:struct...
View ArticleWhy doesn't GCC optimize this call to printf?
#include <stdio.h> int main(void) { int i; scanf("%d", &i); if(i != 30) { return(0); } printf("i is equal to %d\n", i); } It appears that the resulting string will always be "i is equal to...
View ArticleUsing gcc plugins with cross compiler, undefined symbol
I'm trying to see if it's possible to use a gcc plugin in an ARM cross compiler (arm-none-eabi-gcc). I'm running into compiler errors however, and am questioning whether what I'm trying to do is...
View ArticleCompiler changes printf to puts
Consider the following code:#include <stdio.h> void foo() { printf("Hello world\n"); } void bar() { printf("Hello world"); } The assembly produced by both these two functions is:.LC0: .string...
View ArticleCopying to std::chrono::milliseconds with memcpy() gives error...
For this code:std::array<unsigned char, 6> myArray = {123, 123, 112, 0, 15}; std::chrono::milliseconds dest{0}; memcpy(&dest, &myArray, 5); Gcc gives the following error:warning: 'void*...
View ArticleI am trying to implement an insert function in linked list which will insert...
The error message is as follows:/usr/bin/ld: /tmp/cc6bBxdN.o: in function `Insert(int)': linkedlist.cpp:(.text+0x15): undefined reference to `operator new(unsigned long)' /usr/bin/ld: /tmp/cc6bBxdN.o:...
View ArticleMSVC equivalent to '__builtin_return_address'
With msvc, is there an equivalent to gcc's "__builtin_return_address"?I'm looking to find the address of the calling function, 1 level deep.
View ArticleLinker error inline function
I got some compiler/linker errors and i don't know what is the correct method to proceed. I'm in this situation:a.h: in this file is defined a function declared as "inline", for example: inline void...
View Articlestray and null character ignored error when compiling with an archive file?
Everytime I try to run my makefile, a long list of error come up, all of which talk about stray errors. Here is a snipped of what the errors look like (it's too long to put everything) 1 |...
View ArticleAzure DevOps pipeline building Makefile
I'm trying to set up an Azure DevOps build pipeline for CI of a C project that is built using gnu make that eventually runs gcc to compile and link.While I wasn't sure which task to add to the pipeline...
View Article