How do I compile 64bit program with gcc/g++ on a 64bit Linux?
The glibc-devel
package should be correct, however, be sure to use the x86_64 arch package.
In my fedora, glibc-devel.x86_64
was the correct package.
For ubuntu, it might be simply glibc-dev.x86_64
Try one of the following
sudo apt-get install glibc-devel.x86_64
sudo apt-get install glibc-dev.x86_64
Related videos on Youtube
Mike Wong
I am an undergraduate student at the University of Hong Kong, double majoring in Physics and Computer Science. My field of interest is Quantum Information and Quantum Computation, which is also the direction I would take for graduate studies. Programming Languages learnt: C/C++, java, MatLab, python. Currently learning C#, js/php, and computer graphics
Updated on September 18, 2022Comments
-
Mike Wong over 1 year
I'm using Ubuntu 10.04 LTS, and want to make a program to run on a large Debian server that has 300GB memory. With command:
g++ Encoder.cpp -std=c++0x -m64 -o Encoder.o
it returns something like
In files included from /usr/include/features.h:378, from /usr/include/c++/4.4/i486-linux-gnu/64/bits/os_defines.h:39 from /usr/include/c++/4.4/i486-linux-gnu/64/bits/c++confige.h:243, from /usr/include/c++/4.4/iostream:39, from Encoder.cpp:1: /usr/include/gnu/stubs.h:9:27: error: gnu/stubs-64.h: No such file or directory
but without the -m64 flag, the program is compilable, but will run into "segmentation fault" problem whenever RAM usage is over about 2.5GB.
Or would actually the default compilation be 64bit? How do I tell if a process is 32bit or 64bit in "top"?
-
Ramhound over 9 yearsThe error is clear; a header file cannot be found; you need to supply it to compile the program
-
lzam over 9 yearsWhy did you post this to both Super User and Stack Overflow? I think Stack Overflow is probably the better of the two in this case.
-