What's the difference between the .ascii and the .string assembler directives?
I know that the .ascii directive doesn't put a null character at the end of the string. The .asciz directive is used for that purpose. However, I don't know whether the .string directive puts a null...
View ArticleStrcmp Problem Segmantation Fault insert method not working
I used GDB, and realised that the problem was reaching these line of codes:in main:''' else if(strcmp("insert",arg[1])==0){ insert("a.txt","Cem","Mec","Cem","-a");}'''insert method:'''void insert(char...
View ArticleError message in codeblocks: Undefined reference to 'WinMain@16'
I want to run the following code in Codeblocks 20.03, but I get the error message: Undefined reference to 'WinMain@16'. Code:std::string countSheep(int number) { std::string res; std::string s = "...
View ArticleHow to generate dependency files when generating object files of c sources...
I am implementing a build system using the GNU tools, GCC and make to compile multiple targets, link them together and create a final executable. All these support two platforms; the host environment...
View ArticleHow to link MinGW (gcc) and TBB
I am trying to compile my TBB program using MinGW. I know that TBB is installed on my machine correctly because it compiles just fine in Visual Studio. Do I have to do something more to tell MinGW...
View Articlereturn-value deduction for non-static method pointers
I was toying around with function pointers to non-static methods and stumbled upon some GCC-messages that don't quite make sense to me. Let's maybe look at some code:#include<iostream>struct X{...
View ArticleVS Code will not build c++ programs with multiple .ccp source files
Note that I'm using VS Code on Ubuntu 17.10 and using the GCC Compiler.I'm having trouble building a simple program which makes use of additional .ccp files. I'm probably missing something obvious here...
View ArticleOdd error in the CYGWIN console "cygheap base mismatch detected"
I wrote some simple application in C (for test) - GCC 9.3.0 on CYGWIN (x86_64-pc-cygwin) on Windows 10. And it worked fine. But 1-2 days ago Windows 10 was updated (Feature Update 1909 (2)). I dont...
View ArticleWhy LSan (with gcc) doesn't find memory leaks which are allocated by mmap?
I tested it with below code// main.c#include <sys/mman.h>#include <string.h>#include <stdlib.h>int main() { int* ptr1 = (int*)malloc(1); int* ptr2 = (int*)mmap(0, 4096*10,...
View Articleasm/errno.h: No such file or directory
While building gcc, I get this error:In file included from /usr/include/bits/errno.h:25, from /usr/include/errno.h:36, from ../.././gcc/tsystem.h:96, from...
View Articleg++ only looks for .lib files
I am using Windows 10 with mingw-w64. I tried compiling a program with a statically linked library. I used this command: g++ main.cpp -Llibs/ -lfoo. But MinGW says it can't find the library files, so I...
View ArticleNot picking up the correct GCC verison
I am running an environment which requires an older version of gcc (gcc.4.8.3 to be exact).I have this version of gcc sitting at location: /usr/local/bin (see below)I have appended /usr/local/bin to my...
View ArticleWhat is GCC lto wrapper?
I am using buildroot to prepare images for embedded system. I want to export buildroots internal cross compiler so others can use same version, After command checking GCC version: arm-linux-gcc -vI see...
View ArticleDoes pthread_mutex_lock contains memory fence instruction? [duplicate]
Do pthread_mutex_lock and pthread_mutex_unlock functions call memory fence/barrier instructions? Or do the the lower level instructions like compare_and_swap implicity have memory barriers?
View Articleproblems with using types from stdint.h header
I have a header file ptestlib.h, whose contents are given below:#ifndef INCLUDED#define INCLUDED#ifndef FALSE#define FALSE (0)#endif#ifndef TRUE#define TRUE (!FALSE)#endif/* optimization levels...
View ArticleUsing GCC to produce readable assembly?
I was wondering how to use GCC on my C source file to dump a mnemonic version of the machine code so I could see what my code was being compiled into. You can do this with Java but I haven't been able...
View ArticleCMAKE_C_COMPILER is not a full path to an existing compiler tool
I recently explored distcc and couldn't make it work. So I sudo apt-get remove distccAfter that, I get the error ==> Processing catkin package: 'gencpp'==> Building with env:...
View ArticleGAS Assembly : switch - default case trigger [duplicate]
I am analysing how switch is converted from C to aseembly (GAS). I don't understand the GAS's trick how the 'lower edge' default is triggered. There is a conditional jump for 'higher edge' : cmpl $8,...
View ArticleGCC Bit-scan-forward to find next set bit?
I have a uint64_t and I would like to find the index of the first set bit, reset it to zero and find the next set bit. How do I know when to terminate? BSF on all zeros is undefined...const uint64_t...
View ArticleWhat are the "STANDARD SYSTEM DIRECTORIES" that gcc refers to? (On a unix...
I've been exploring compilers and cross compilers. I'm reading the GCC manual.Specifically, there are these statements in the manual that I have queries regarding:The linker searches a standard list of...
View Article