strange dynamic_cast behavior when target variable has same name with source...
#include <iostream>#include <string>using namespace std;struct Foo { virtual ~Foo() = default; int foo = 321;};struct Bar: public Foo { int bar = 123;};int main() { const Foo* ptr = new...
View ArticleCommandline "help" for Windows Cmd(Mingw64)
Trying to get the commandline to show Mingw64 online help manual on Windows10Pro-64 Cmd/Powershell, similar to the "man command_name" command on Bash (which shows verbose online manual help for the...
View Articleg++ :cannot execute ‘DIRECTORY/collect2.exe’:CreateProcess: No such file or...
When I compile c++ and c files together with the following command:g++ io.c *.cpp -o main -D__STDC_FORMAT_MACROSerror occurs:g++.exe: fatal error:cannot execute...
View ArticleIs an extra move somehow faster when doing division-by-multiplication?
Consider this function:unsigned long f(unsigned long x) { return x / 7;}With -O3, Clang turns the division into a multiplication, as expected:f: # @f movabs rcx, 2635249153387078803 mov rax, rdi mul...
View Articlehow to hide local symbol for linux static library
I'm going to ship a to static library to a customer.To maximize the privacy of the library I have restricted symbols for the static library using the technique provided by @ypsu Symbol hiding in static...
View ArticleWhat is the default C -std standard version for the current GCC (especially...
When I ask to see the current version of cc I get this.$ cc --versioncc (Ubuntu/Linaro 4.7.2-2ubuntu1) 4.7.2Copyright (C) 2012 Free Software Foundation, Inc.This is free software; see the source for...
View Articlecross-compile error while loading shared library
I have run gcc cross compiler from ubuntu(x86) to arm. this cross compiler works fine on ubuntu 14, and not I try in on ubuntu 18.I tried to compile simple program #include <stdio.h>void main() {...
View Articlehow to use graphic.h in VScode
I am using VScode ( MinGW - gcc ) for C and want to use VScode for C graphics.I just shifted from Turbo C : /while including graphic.h it gives me ↓#include errors detected. Please update your...
View Article[C++ Library]: "file or folder does not exist" when compiling
I want to develop a small application which uses some libraries. So I downloaded them and placed the include files in a folder called include.For my application, I used cpprestsdk, but my question...
View ArticleInvalid argument when compiling GLFW code?
Source code:#include <glfw3.h>int main(void){ GLFWwindow* window; /* Initialize the library */ if (!glfwInit()) return -1; /* Create a windowed mode window and its OpenGL context */ window =...
View ArticleGCC compiler in CLION not found in PATH so cannot compile simple C++ program
When I try to compile a simple main.cpp consisting of:#include <iostream>int main() { std::cout << "Hello, World!"<< std::endl; return 0;}CLION tells me that:-- The C compiler...
View ArticleWhy does gcc give an overflow warning when the variable is replaced with a...
Compiler: x86_64-gcc-9.3Flags: -O3 -Wall -WextraIn:int main(){ int x= 4, y = 7; x = y*(4LU - 5); return x;}I get no warnings.But, if I replace y with 7, I get the following warning:warning: overflow in...
View ArticleHow can I configure Codeblocks to not close the console after the program has...
I should specify, I do not want to do the waiting for input thing or to use the debugger. I want the program to run and terminate as it normally would, but where the console window doesn't close after...
View Articleg++: undefined reference to `_imp___ZN5pluma13Plxxxx
I want to compile project "pluma".I use mingw,and open this project with codeblock with default cbp.The first two project go well, with following log:mingw32-g++.exe -std=c++0x -Wall -DPLUMA_EXPORTS -g...
View ArticleDeclaring a variable outside main function changes output even though there...
So I have been working on a question and this think stumbled upon me. When I declare a variable outside the main function, the program works correctly, that is it reaches the else case of "Friendship...
View ArticleUnable to install GCC using anaconda
This is output of the command conda install gcc: Solving environment: failedPackagesNotFoundError: The following packages are not available from current channels: - gcc-6
View ArticleWith the -Ofast flag on gcc, does breaking down a math expression affect speed?
i want to know whether, with the -Ofast flag on gcc, the codex += (a * b) + (c * d) + (e * f);is faster/slower/the same as/than this code:x += a * b;x += b * c; x += e * f;I have a math expression like...
View ArticleHow to compile a single line of C++ code in gcc or g++ using Linux terminal...
One can run python command in terminal Example:>>> 2 + 35>>>Can one compile a single line of code without writing it in a text file?
View ArticleGCC linker script
So I have an old code written for ARM compiler with many #pragma for assigning variables and functions to sections like this:...thousands lines of code #pragma arm section blah = "blah"...thousands...
View ArticleHow to assemble ARM instructions (using GCC)
I want to assemble ARM instructions (= converting the textual assembly instructions to machine code).I tried using IDA Pro to disassemble an ARM binary but upon assembling it told me:Sorry, this...
View Article