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

CMake: The C Compiler is not able to compile a simple test program

I am trying to cross-compile the Azure IoT SDK C for a Mips processor. Cross-compiling an older version of the same SDK using an older version of CMake (2.8.12.2) works just fine, so I doubt it's the...

View Article


Why does this type conversion [not] work?

Consider the following code (live demo):class Foo { public: void method(); }; template <typename T> struct Member; template <typename T> struct Member<void (T::*)()> { using Object =...

View Article


GCC in a nutshell [closed]

I'd want to learn about gcc compiler (not internals but how to use it). And can't decide what resource to pick. I found a couple of books, official documentation and that's literally all. The problem...

View Article

My code works for 200,000 prime numbers but shows segmentation error(core...

'My code works for 200,000 prime numbers but shows segmentation error(core dumped) when i try to run it for 2,000,000 numbers'using namespace std; int main(){ long long n; cin>>n; long long...

View Article

Removing trailing newline character from fgets() input

I am trying to get some data from the user and send it to another function in gcc. The code is something like this.printf("Enter your Name: "); if (!(fgets(Name, sizeof Name, stdin) != NULL)) {...

View Article


CMake and Static Linking

I'm using CMake in a project, and I'm trying to statically link some libraries. I've set:set(BUILD_SHARED_LIBS OFF) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++ -static")...

View Article

sizeof(array) within array declaration of implicit size

Consider the following common array definition, note that the array itself has to includes total size:#define BUFSZ 3 uint8_t buffer[BUFSZ] = { BUFSZ, 0xFF, 0x00 } This is not very handy when you...

View Article

Where is the clang header file?

I was digging around in some C internals, and I found the following line from clang's stddef.h (located in /usr/lib/llvm-11/lib/clang/11.0.0/include/):typedef __WCHAR_TYPE__ wchar_t; This is different...

View Article


SIGFPE when accessing unordered_map

I have an unordered_map<Block, int> with Block being a simple struct defined as follows:struct Block { size_t start; size_t end; bool operator==(const Block& b) const { return start ==...

View Article


I linked gcc using homebrew, however, cannot find gcc

I linked gcc using Homebrew, however, what I can see are gcc-9 and g++-9. I cannot see gcc and g++.Before I link them, I had a gcc and g++ in the path of /usr/bin, however, there version is 4.2.1. So...

View Article

Linux process stack overrun by local variables (stack guarding)

From What is the purpose of the _chkstk() function?: At the end of the stack, there is one guard page mapped as inaccessible memory -- if the program accesses it (because it is trying to use more stack...

View Article

How to use Bazel as a build tool in Conan.io

I am trying to use Conan for package management and Bazel as build tool for my C++ Codes. The reason I am using conan is because JFrog Artifactory supports it, which I am using as my Artifactory...

View Article

Fixed 64 bit integer in Linux Kernel

I want to have a fixed size integer of 64 bits in linux kernel.My questions:If I use unsigned long, then it may be 64-bit on one architecture and 32-bit on another. Right? What would be the data type...

View Article


make g77 command not found

I am trying to make a project:https://www.cs.virginia.edu/stream/FTP/Code/it reports:make: g77 command not found. I saw this line in Makefile:FF = g77 Can I change 'g77' here to something else to...

View Article

Suppress "is valid for C/ObjC but not for C++" warning in gcc

I've got a third-party build script for a c project, and I'm trying to add a c++ source file to that project. I don't really want to make any changes in script itself because then I'll have to keep my...

View Article


gcc in Nix has no permission and get error: " `gcc' failed in phase `Linker'....

I was reading some tutorial about Nix and tried installing gcc.After that when I start working on my haskell project with stack test I got this.discordia> build (lib + test) Preprocessing library...

View Article

Ninja doesn't use CC and CXX?

I'm compiling Tesseract with Ninja. Clang has some linking problem, but gcc works. I exports CC and CXX with gcc and make -j8 runs fine. However, Ninja (using the given script in /build folder) still...

View Article


Casting from double always returns zero

Why does the following code returns zero, when compiled with clang?#include <stdint.h> uint64_t square() { return ((uint32_t)((double)4294967296.0)) - 10; } The assembly it produces is: push rbp...

View Article

How to access anonymous union/struct member from another header data?

I want to access a member of struct from some header data. Here is an example from my code:char wk1[2]; union { unsigned short WORD; struct { unsigned short SSBY:1; unsigned short OPE:1; } BIT; }...

View Article

GNU const/pure attributes vs constexpr

GNU C and C++ offer the const and pure function attributes. From the gnu online docs (emphasis mine):In GNU C and C++, you can use function attributes to specify certain function properties that may...

View Article
Browsing all 22016 articles
Browse latest View live


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