Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Browsing all 22070 articles
Browse latest View live
↧

Does native C have common symbol?

In GCC10, gcc default to fno-common. That means, all tentative defined symbols are not common. I think gcc conforms to the C specification but it seems there are no common symbols in the native C...

View Article


How to compile for Windows on Linux with gcc/g++?

I have written some effects in C++ (g++) using freeglut on Linux, and I compile them withg++ -Wall -lglut part8.cpp -o part8So I was wondering if it is possible to have g++ make static compiled Windows...

View Article


A function to read new line in c from a given stream

I'm experimenting with a c function that reads a new line from a given FILE*let's assume the pointer beforehand has already been malloced.#include <stdio.h>#include <stdlib.h>#include...

View Article

How to print result of a compile-time calculation in C++?

I've wrote several constexpr functions and use them in static_asserts to control some resource limits. But I'd like to not only enforce compile-time predicate but also to see the actual values...

View Article

How to install GCC and GDB for WSL(windows subsytem for linux)?

I need gcc to compile a c code and unable to install gcc on wsl. I tried sudo apt-get install gcc but it doesn't work. This is the error.hack@DESKTOP-VMQA3JB:~$ sudo apt-get install gccReading package...

View Article


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 Article

Creating a Unix file in intel_syntax noprefix from a c program using GCC on...

thanks for your help in advance.I would like to convert a .c file to .s file using gcc. I'm able to do it quite easily with gcc -m32 -S my_file.c but it's written in a syntax i'm not familiar with. Is...

View Article

How do I tell GCC to either not initialize the stack during _start, or...

I'm using the aarch64-none-eabi toolchain. The start code seems to be resetting the stack pointer to 0, even though the stack pointer is already configured when I call the code. If I jump and start...

View Article


How can I add a library I downloaded to my C compiler?

I've downloaded CSFML from github and would like to use it in one of my programs. How can I do so? I have a source folder containing some header files. It has three sub-folders.includelibshare

View Article


What's a performant and clean way to parse a binary file in C?

I'm parsing a custom binary file structure for which I know the format.The general idea is that each file is broken up into blocks of sequential bytes, which I want to separate and decode in...

View Article

Why can't I edit a char in a char*?

Below is an exceedingly simple example. It compiles fine using gcc on Mac OS X (Snow Leopard). At runtime it outputs Bus error: 10. What's happening here?char* a = "abc";a[0] = 'c';

View Article

How can I build standalone static library in c for a firmware module

How can I build a standalone static library (.a) for a firmware module and link that static library in the main project (without providing access to header files in that module) ? I know about ar...

View Article

Bison parser always prints "syntax error"

I am trying to build a 3 address code generator which would produce:input:x=a+3*(b/7)output: t1=b/7t2=3*t1t3=a+t2x=t3NO matter whatever i give as input the output is "syntax error".I'm using Windows...

View Article


How can I link the 3rd party library bzip2 in my gcc compiler?

I'm a python developer new to C and developing C code on Windows that needs to work on Windows and Linux.To that end, I downloaded MSYS2 and used pacman to install gcc and bz2.My question is: How do I...

View Article

Simple example where [[likely]] and [[unlikely]] affect program assembly?

C++20 introduced the attributes [[likely]] and [[unlikely]] to the language, which can be used to allow the compiler to optimize for the case where one execution path is either much more likely or much...

View Article


Why doesn't my gcc compiler recognize the bzip2 functions, yet allows me to...

I'm writing a file parser in C using gcc on Windows using MSYS2.Using pacman I've downloaded the required libraries for using libbzip2.For some reason, I can include the bzlib.h file and use the...

View Article

Making a function that defaults to aliasing an externally defined symbol in...

I have a header-only library that's currently calling malloc and freeThis header is included in a lot of different static libraries, which are used to build differently configured programs.I would like...

View Article


GCC segfault caused by "optimised out" value in MATLAB MEX function

I am trying to write a fairly simple recursive floodfill algorithm (to be run as a MATLAB mex function), but have run into an issue when turning on optimisation flags in GCC (v 7.5.0 if it matters)....

View Article

Is there a compiler option that could be used to initialize stack variables...

A common type of bug in C programs is that the program uses some uninitialized data, most often assuming something is zero when it has in fact never been initialized to zero. Such a program can seem to...

View Article

How to install MingGW 64 on WIndows 10?

Since I want to debug arduino sketch in VS Code, I have already installed Arduino and C/C++ extensions into it. And I should install MingGW-64 for GCC either. But the program I downloaded has no bin...

View Article
Browsing all 22070 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>