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

Why does gcc -ansi remove the declarations of cosf and the like?

You probably think I am completely crazy and terribly bad at programming. One of those may be the case, but please read my findings.Yes, I #include <math.h>Full Code can be found here.( I was...

View Article


Is there a method for versioning header and library dependencies in C?

We have a repo that contains library functions for example (gcc is used to compile and link).//print.h #ifndef __PRINT_H_ #define __PRINT_H_ #define MAX_ARRAY 10 void print_hex(int cal[]); #endif //...

View Article


GCC: --whole-archive recipe for static linking to pthread stopped working in...

Static linking against pthread is a difficult topic on Linux. It used to work to wrap -lpthread as -Wl,--whole-archive -lpthread -Wl,--no-whole-archive (the details can be found in this answer).The...

View Article

when g++ static link pthread, cause Segmentation fault, why?

#include <iostream> #include <map> #include <thread> #define SIZE 1024 #define AMOUNT 100000 #define THREADS 4 class A { private: char a[SIZE]; }; void test() { std::cout <<...

View Article

Clang on Windows with MinGW

I have both MinGW gcc and Clang clang installed and added to path via chocolatey, and both can be found on the command line. However, when I try to use clang with gcc, clang doesn't seem to know where...

View Article


Getting directory of executable failed [duplicate]

This question already has an answer here:Getting array size in C. Cannot understand output 6 answersSo I've used the following code a couple of times and always put it directly into the main function,...

View Article

Building an Executable that Can't be Ran

I am getting vk: command not found when running vk, and getting bash: ./vk: No such file or directory when executing ./vk. I did some research and the cause is usually that it isa 32bit exe on a 64bit...

View Article

Make warn_unused_result applied to all function with GCC

Is it possible to tell GCC to use warn_unused_result flag for all function even not having the corresponding attribute? Because if I can forget to check for return value, I can also forget to add the...

View Article


Why does GCC generate 15-20% faster code if I optimize for size instead of...

I first noticed in 2009 that GCC (at least on my projects and on my machines) have the tendency to generate noticeably faster code if I optimize for size (-Os) instead of speed (-O2 or -O3), and I have...

View Article


Segmentation fault in a function

I want to find the address of an integer in an array. Debugger revealed that line 8 is at fault. if (*i==item) {ans=i;};Variable ans is local and not null, yet segmentation fault occurs. Why is that...

View Article

/usr/include/time.h:243:29: error: expected identifier or ‘(’ before ‘__const’

When I used gcc to compile program,I meet this error messages,and i have searched answers online,but can not find any results,so I want to ask how to fix this?

View Article

How to clean up a GCC Makefile

I just took over a GCC project containing a makefile that has way to many include folders and source files listed. I started removing one by one and verified by compiling, but wondered, is there some...

View Article

What are the GCC default include directories?

When I compile a very simple source file with gcc I don't have to specify the path to standard include files such as stdio or stdlib.How does GCC know how to find these files?Does it have the...

View Article


How to force enum size with GCC? [duplicate]

This question already has an answer here:Specifying size of enum type in C 9 answersTo ensure binary compatibility with the product I'm working on, I need to force some of my enums to be represented by...

View Article

undefined reference to `_GLOBAL_OFFSET_TABLE_' in gcc 32-bit code for a...

I have a small c code file(function.c):int function() { return 0x1234abce; } I am using a 64 bit machine. However, I want to write a small 32 bit OS. I want to compile the code into a 'pure'...

View Article


GCOV code coverage files doesn't get updated

The *.gcda files generated by execution of my program doesn't get updated. I compile my program with cross compilation and run it on target system. Once the program get executed the *.gcda file...

View Article

An error occurred while installing package gcc-7 in anaconda

I'm setting up a new server,and want to install gcc-5/6/7.I don't have root access to the server,so I chose conda to install my own env.However,some mistakes have occurred.Does anyone know how to solve...

View Article


Qt widgets limit exceeded

I am using Qt 5.6 . I have created a application which contains many widgets such as labels,Buttons..etc. Now I added a label in to my gui , But I am not able to access the label (ui->label_name)....

View Article

-isystem for MS Visual Studio C++ Compiler

I usually like to have a lot of warnings enabled when programming. However, some libraries contains code that easily causes warnings (.., python, Qt, ..). When compiling with gcc I can just use...

View Article

How can I tell gcc not to inline a function?

Say I have this small function in a source filestatic void foo() {} and I build an optimized version of my binary yet I don't want this function inlined (for optimization purposes). is there a macro I...

View Article
Browsing all 22002 articles
Browse latest View live


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