Updating struct members in a for-loop
Is there a way to update struct members in a for loop, I want to avoid having to update the members one-by-one. For example: Instead of doing this:void Update(int vaule,struct Coolstruct *Ice){ int...
View ArticleHow to concat __func__ and __LINE__ in a macro definition
I would like to define a macro to concat __func__ (or __FUNCTION__) with __LINE__:The following works fine:// macro_test.cc#include <iostream>#define STR2(X) #X#define STR(X) STR2(X)#define...
View ArticleGDB - why its showing 16 bytes in addresses [closed]
memory add. are showing like -` 0x0000555555555175 <+0>: push rbp 0x0000555555555176 <+1>: mov rbp,rsp 0x0000555555555179 <+4>: sub rsp,0x30 0x000055555555517d <+8>: mov QWORD...
View ArticleGcc compiled executables produces "access denied" message?
I have set path to the gcc inside the dev-c . It compiles fine and creates the executable but it fails to run the program and shows a message box (as shown in the first picture) first and then prints...
View Articlebuild 32-bit code on 64-bit linux system (kubuntu 18.04)
I'm looking into porting a 32-bit AIX app to linux - doing proof of concept on my 64-bit Kubuntu desktop system. I suppose I could build the app in 64-bit mode, but I'm afraid stuff might break (there...
View ArticleSpecifying compiler versions in travis for cmake builds
The travis Building a C++ Project documentation shows how to specify gcc and clang compiler versions in build matrices. However, it does not show how to build projects with those compilers using...
View Articlegcc "undefined reference to"
I'm having trouble finding why my program wont compile. Im not very good at C so I hope someone can spot my error. I was told it was probably a header issue, that is why I'm starting with this. This is...
View ArticleVery Sleepy profiler confuses mere variables as functions, among other issues
I've been looking for a C profiler for Windows, that will allow me to inspect time spent in the level of source-code lines, as opposed to just at the level of functions. This is in order to find...
View ArticleIs there a way to get warned about unused functions?
I'd like to find unused functions in a codebase - including across compilations units. I'm using gcc as my compiler. Here's an example:foo.c (assume appropriate foo.h):void foo() { ....}void bar() {...
View ArticleHow to write Makefile to compile c and c++ on Mac OSX
I downloaded git project.I'm trying to compile with makefile on Mac OSX(10.14.6)but I failed with this errorI guess trying to compile mix of c and cpp file make this errorBut it works in Ubuntu...
View ArticleValgrind error message doesn't provide useful information
I am trying to debug memory problems with my program, however the error messages that are coming out of valgrind are unhelpful. Here is an example.==3944334== 184 bytes in 1 blocks are possibly lost in...
View ArticleWhat's the difference between "statically linked" and "not a dynamic...
Consider this AMD64 assembly program:.globl _start_start: xorl %edi, %edi movl $60, %eax syscallIf I compile that with gcc -nostdlib and run ldd a.out, I get this: statically linkedIf I instead compile...
View ArticleC++ Preprocessor do not show "expanded from"
Quick question:My code makes extensive Code of macros, let's say it's a macro named X.That macro takes some code as a parameneter, like that: X(const int i;)If that code contains an error, most...
View ArticleValgrind possibly lost in _dl_init libgobject libglib
I am trying to debug memory problems with my program, however the error messages that are coming out of valgrind are unhelpful. Here is an example.==3944334== 184 bytes in 1 blocks are possibly lost in...
View ArticleTrying to store invalid hexadecimal number in int variable
I have a very basic doubt. I am trying to store any invalid hex number in an int variable. By invalid number i mean a number that is using alphabets that are not in A-F range. For example see this...
View ArticleHow to solve error: missing binary operator before token "(" on mac?
I am currently trying to install PySift inside a virtualenv on Mac. However, the Zstandard library results in an error when being installed.In file included from /usr/include/Availability.h:236:0, from...
View ArticleCompile error on python weave module (ubuntu)
I try to run the file Diehl&Cook_spiking_MNIST.py here:https://github.com/peter-u-diehl/stdp-mnist.the output:/home/showtsai/data/py2_env/lib/python2.7/site-packages/brian_no_units.py:4:...
View ArticleWhy is TLS/thread local storage/thread_local keyword slow? (linux, clang 10,...
Both clang (10) and gcc (9.3) suffer from this. I have a few global variables. I iterate through data_in and write to both data_out and misc_data (but this one a lot less). My runtime goes from 70ms to...
View ArticleCompiling SDL2 + OpenGL + GLAD project in Code::Blocks on Windows: undefined...
I'm checking different variants of creating windows applications that use OpenGL code. I'm especially interested in OpenGL Core Profile (so called "modern OpenGL"). I'm using Code::Blocks as my IDE.At...
View Articlegcc errors “No such file or directory”
Trying to compile a source code written in C.Location of the code is: C:\Users\Chris\Documents\prog\c\learn\GOODBYE.CIn CMD I typed the code: gcc goodbye.c -o goodbyeGot this error:gcc: error:...
View Article