Questions tagged [gcc]

14928 questions
0

votes
0

answer
6

Views

E: Package 'gccxml' has no installation candidate

So, I am unable to find gccxml in ubuntu18,hep me download gccxml in ubuntu18. castxml is easily available. But I need gccxml. Also what is installation candidate? Thanks.
Aadil Hoda
1

votes
1

answer
39

Views

C Redirection causes scanf to not accept input

For some reason, scanf isn't working properly after using c redirection to pass input to stdin. I've tested the same code with no c redirection and it works perfectly fine. Also, I've tried flushing stdin before doing scanf operations with fflush(stdin) and that also did not work. Running my executa...
cheesey
0

votes
1

answer
33

Views

Why does gcc use a relative address to the function pointer in assembly? [duplicate]

This question already has an answer here: Why is the address of static variables relative to the Instruction Pointer? 1 answer 32-bit absolute addresses no longer allowed in x86-64 Linux? 1 answer The C source: int sum(int a, int b) { return a + b; } int main() { int (*ptr_sum_1)(i...
MiniMax
0

votes
0

answer
16

Views

While compiling Python 3.5 from source I'm getting compiler warnings

I need Python 3.5, however sadly Linux Mint 19, which I have, ships with Python 3.6. For this reason I'm trying to compile Python 3.5 from source code, obtained from python.org. To my surprise, gcc spits out warnings during the process. Examples of warnings include: In file included from /usr/includ...
gaazkam
0

votes
1

answer
17

Views

Finding and printing the last word of a string with a space or tab delimiter

I'm trying to get the last word of a string as an argv parameter in C. How can I find the last word and delimit the strings that contain a space/tabs? The definition of a word is "a section of string delimited by spaces/tabs or by the start/end of the string." I initially made a function to identify...
Zeid Tisnes
0

votes
0

answer
8

Views

gcc options: pkg-config --libs --cflags gtk+-3.0

I am trying to learn gtk and following this link : http://zetcode.com/gui/gtk2/firstprograms/ I was able to get a basic program to run. The way to compile the code was to use the command: gcc -o simple simple.c `pkg-config --libs --cflags gtk+-3.0` I want to understand what the flags pkg-config --l...
point.blank_
0

votes
0

answer
4

Views

Running gcc 5.2 build on gcc 4.4.7 Red Hat 6.6

We built an exe using gcc 5.2 (g++ and --std=c++14 if that matters). Our current deployment machine: $ cat /etc/red* Red Hat Enterprise Linux Server release 6.6 (Santiago) It has following libc: $ /lib/libc-2.12.so Compiled by GNU CC version 4.4.7 20120313 (Red Hat 4.4.7-9). Compiled on a Linux 2.6...
vptr
1

votes
1

answer
3k

Views

How to compile libusb as shared library?

I am trying to build libusb as shared library as follows. Following are two steps. 1. Configure 2. Make. I pass "--enable-shared" to configure script assuming it will generate the shared .so file Configure ./configure CC=/mnt/store/gcc-linaro-arm-linux-gnueabihf-4.9-2014.09_linux/bin/arm-linux-gnuea...
Milind Dumbare
14

votes
3

answer
469

Views

How can modern compiler optimization convert recursion into returning a constant?

When I compile the following simple recursion code with g++, the assembly code simply returns i, as if g++ can do some algebra tricks as humans can. int Identity(int i) { if (i == 1) return 1; else return Identity(i-1)+1; } I don't think this optimization is about tail recursion, and apparently, g++...
johnjohnlys
6

votes
3

answer
172

Views

Does stack space required by a function affect inlining decisions in C/C++?

Would a large amount of stack space required by a function prevent it from being inlined? Such as if I had a 10k automatic buffer on the stack, would that make the function less likely to be inlined? int inlineme(int args) { char svar[10000]; return stringyfunc(args, svar); } I'm more concerned abou...
JasonN
1

votes
1

answer
699

Views

Yocto meta-toolchain fatal error: stdio.h: No such file or directory

Question: How to add the standard library to arm-fslc-linux-gnueabi-gcc Background: I just had bitbake compile the meta-toolchain in the Yocto project. I then installed the resulting SDK-toolchain $ ./build/tmp/deploy/sdk/fslc-framebuffer-glibc-x86_64-meta-toolchain-armv7at2hf-neon-toolchain-2.4.2....
Mattis Asp
1

votes
1

answer
72

Views

Intel compiler doesn't recognise identifiers from gcc' avxintrin.h

I am trying to enable AVX instructions in my project. I can build it with gcc (gcc -mavx), but not with Intel compiler (icpc -maxv) which fails in avxintrin.h gcc header with the following errors: no declaration for "__m256d" identifier "__builtin_ia32_loadupd256" is undefined Just for reference, he...
me76
0

votes
0

answer
4

Views

Keep all exported symbols when creating a shared library from a static library

I am creating a shared library from a static library for which I do not have the source code. Many Stack Overflow questions provide answers on how to do that: gcc -shared -o libxxx.so -Wl,--whole-archive libxxx.a -Wl,--no-whole-archive However, some public functions of the static library are include...
Étienne
0

votes
0

answer
17

Views

Getting error “passing argument 2 of ‘strcmp’ makes pointer from integer without a cast” comparing two strings

Im a student, and im trying to complete this program, which his objective is: Print the data of the product that has the same name as the requested name in input Everytime, when i try to compile the program, this warning appears: warning: passing argument 2 of ‘strcmp’ makes pointer from in...
Meltix
2

votes
1

answer
31

Views

Why does running C code in Vim skip scanf()?

I'm using neovim in arch linux with the gcc C compiler, this is what I use in my .vimrc to compile and run map :w :!gcc % -o %< && ./%< The issue is that my code will run fine but any scanf() functions won't prompt an input and will be ignored as the program will runs. Even after compiling with...
Tom1
0

votes
1

answer
14

Views

Will -Wpedantic do anything when compiling with a non-extension -std?

If I compile my C or C++ code with GCC, using -std=c99 or -std=c++11 or some other proper ISO standard rather than a GNU extension - will -Wpedantic issue more warnings that I would usually get? e.g. With -W, -Wall or -Wall -Wextra?
einpoklum
4

votes
3

answer
629

Views

No exe file being generated in C using recent Cygwin versions

GCC 4.9.2 does not create an executable, neither a.out or -o hello.exe. Adding -v to the compile line indicates that -o is switched to a non-existent temporary file, for example: -o /tmp/ccr6nMlO.s Recent installs of Cygwin NT-6.1 over the last few months onto both Windows XP and Windows 7 have all...
red69
1

votes
2

answer
366

Views

Compiler generated destructors and warnings in GCC and MSVC

I'm working on clearing some warnings that show up on both GCC and MSVC when elevated warnings are in use. I'm catching a "class has virtual functions, but destructor is not virtual instances of this class may not be destructed correctly" under MSVC. I get a similar warning under GCC and Clang when...
jww
1

votes
3

answer
1.6k

Views

How to install a specific version of a package with pip

I want to install Pyquery 1.2.4 version, but when I try pip install pyquery==1.2.4 I face with Compile failed: command 'gcc' failed with exit status 1 creating tmp cc -I/usr/include/libxml2 -c /tmp/xmlXPathInitXZJM6c.c -o tmp/xmlXPathInitXZJM6c.o /tmp/xmlXPathInitXZJM6c.c:1:26: error: libxml/xpath...
Yusef Mohamadi
1

votes
1

answer
1.8k

Views

Compiling with gfortran: undefined reference to iargc_

I'm using gfortran [GNU Fortran (GCC) 4.8.3 20140911 (Red Hat 4.8.3-7)] on a Fedora 20 x86_64 to compile a bunch of Fortran 77 code which refers to 'iargc' function in the following manner: bin2D2nc.f:31: integer iargc,strlen1 bin2D2nc.f:32: external iargc,strlen1 bin2D2nc.f:44: i=iargc() W...
Paulo Santiago
24

votes
2

answer
1.3k

Views
3

votes
6

answer
132

Views

Why/how does gcc compile the undefined behaviour in this signed-overflow test so it works on x86 but not ARM64?

I was self-studying CSAPP and got a strange result when I ran into a strange issue during the run of a assertion test. I'm not sure what to start this question with, so let me get the code first (file name visible in comments): // File: 2.30.c // Author: iBug int tadd_ok(int x, int y) { if ((x ^ y)...
iBug
1

votes
1

answer
656

Views

Building GCC 5.2 on RHEL6

Since I needed C++14 support for one of our projects, I was trying to build GCC5.2 on my RHEL6 instance using the steps described in http://en.librehat.com/blog/build-gcc-5-dot-2-on-rhel-6/. However, though these steps work well on a RHEL5 instance, I get the following error on AmazonLinux during th...
samudra
1

votes
2

answer
319

Views

How to work with regular expressions in c++ with gcc 4.8 and without C++11 flag?

I recently found out that regex support in gcc 4.8 is incomplete, and it was truly implemented in gcc 4.9 (see Is gcc 4.8 or earlier buggy about regular expressions?). So, wanting to work with regex in my c++ program, I updated my gcc to 4.9 following this instructions (https://askubuntu.com/questio...
jotadepicas
1

votes
1

answer
930

Views

how to export symbols in NASM

My function is not exported by NASM assembler and therefore I can not link it with my C program. I am using the export directive like the manual says, but it is not recognized. What is wrong? Here is how I do it: [[email protected] test]$ cat ssefuncs.S use64 section .data NEW_LINE_4_SSE db '111111111111...
Nulik
1

votes
1

answer
1.9k

Views

collect2: error: ld returned 1 exit status, gcc

When I compile the following program,I am given the following error debian:~/uni/Ass0$ gcc fgetline.c -Wall -o enquote /tmp/ccFnIr1N.o: In function `main': fgetline.c:(.text+0xfe): undefined reference to `fgetline' collect2: error: ld returned 1 exit status After a bit of reading, I have found this...
Ausghostdog
0

votes
3

answer
1.9k

Views

Questions about u-boot relocation feature

I am using the u-boot-2011.12 on my OMAP3 target, the cross tool chain is CodeSourcery arm-none-linux-gnueabi, I compiled u-boot, downloaded it onto the target and booted it, everything went fine,but I have some questions about the u-boot relocation feature, we know that this feature is base on PIC(...
Qing
1

votes
3

answer
5.6k

Views

How to install python2.6 in alpine container?

How to install python2.6 in alpine docker container. I tried to install from source, its giving me compilation errors. Actually I want to install Python2.6 and Python2.7 in container. So that I can run unittests on both Python2.6 and Python2.7. Please give some thoughts on this. I have installed g...
RMK
1

votes
1

answer
245

Views

How to build a Postgres extension using cgo

Here is what I'm doing right now, . ├── helloworld--1.0.sql ├── helloworld.control ├── helloworld.go └── Makefile helloworld.go : package helloworld /* #cgo LDFLAGS: -rdynamic #include "postgres.h" #include "fmgr.h" #include "utils/builtins.h" PG_MODULE_MAGIC; PG_FUNCTION_INF...
Amos
1

votes
0

answer
8

Views

Fast symmetric binary matrix multiplication using vector extensions

I'm using a binary matrix representing an undirected graph and toying with gcc's vector extensions to see what can be done to produce a matrix product (replacing +/* operations with |/&) efficiently. The following attempt assumes both input matrices are symmetric about the diagonal: typedef unsigned...
Brian Vandenberg
1

votes
1

answer
65

Views

C coding, unexpected behaviour when comparing float value [duplicate]

This question already has an answer here: Is floating point math broken? 28 answers I'm getting an unexpected behaviour when comparing a float value, I understand that floats could have rounding precission issues but here numbers are quite specific to present those issues. #include int main() { f...
Ray
1

votes
1

answer
976

Views

undefined reference to libnuma

i'm trying to compile a simple test-program with libnuma (only numa_available is called) and i get a undefined reference error for this function. At first, i used apt-get to install libnuma-dev and then simply used gcc -lnuma -o test test.c to compile the test program. This led to 'undefined refere...
user1583166
1

votes
2

answer
244

Views

How to implement large vector initialization that compiles with gcc-4.4?

I have a list of 20k known strings that I know at compile time and will never change. A sort of non-configurable dictionary. I do not want to load it in run time from a file, because this would imply a lot of unnecessary architecture: finding the file in a certain path, a configuration file to indic...
Jordi Adell
1

votes
1

answer
531

Views

gcc download on windonws ubuntu bash IP address fetch returns error

I've attempted to gcc a test.c file on my windows linux bash subsystem, gives me the "gcc not installed" so i go and try to install gcc using sudo apt install gcc so i'm using the root "sudo" so permissions should be granted, and i've tried with a few different variations of the install command Wh...
Andre Fu
1

votes
1

answer
3k

Views

How to configure gcc to use -no-pie by default?

I want to compile the following program on Linux: .global _start .text _start: mov $1, %rax mov $1, %rdi mov $msg, %rsi mov $13, %rdx syscall mov $60, %rax xor %rdi, %rdi syscall msg: .ascii "Hello World!\n" However, it gives me the following linker error: $ gcc -nostdlib hello.s /usr/bin/ld:...
Aadit M Shah
0

votes
3

answer
33

Views

What alternative can I use instead of gets() and puts()?

int main(int argc, char *argv[]) { char str[MAX_SIZE] gets(str); printf("\n"); Above is a snippet of my code where I use gets() and below is where I use puts printf("The most probable key is: %d\n", max2); puts(output); return 0; I did not paste my whole code since it seems pretty irrelevant for my...
Blythe S.
1

votes
2

answer
71

Views

What is the difference between Early inliner and IPA inliner in GCC?

Reading through GCC code comments and online documentation, it seems there are two types of inliners - Early inliner and the IPA inliner. For example, in gcc/ipa-fnsummary.c /* When optimizing and analyzing for IPA inliner, initialize loop optimizer so we can produce proper inline hints. When optim...
Cherry Vanc
1

votes
1

answer
61

Views

How to build a gcc compiler on Linux that builds both 32-bit and 64-bit code

I followed the directions in the following URL to build a gcc compiler for Linux: https://solarianprogrammer.com/2016/10/07/building-gcc-ubuntu-linux/ The resulting compiler builds 64-bit code with no problems. However, when I try to build 32-bit code (by specifying the -m32 compiler option), I get...
rohitsan
1

votes
2

answer
64

Views

Unable to link libraries when compiling native node modules to Android. Recompile with -fPIC issue when using -fPIC flag

This question is mostly related to node-gyp, GCC and the NDK toolchain, but I will add the full context because it may be necessary. Context I am building an App using React Native. Since I need to use node native libraries in this App, I am using this node module nodejs-mobile for running a Node.js...
Franco
1

votes
2

answer
56

Views

How to deal with -Wreturn-type for switch over C++11 enum class?

If I have a function that returns based on switching over a enum class, gcc emits warning: control reaches end of non-void function [-Wreturn-type]. Example code: enum class Test { a, b, c } ; int foo(Test test) { switch (test) { case Test::a: return 0; case Test::b: return 1; case Test::c: return 2...
Peter

View additional questions