Questions tagged [c++]

C++ is a statically typed, free-form, multi-paradigm, compiled, general-purpose programming language.

319 questions
34
votes
3 answers

Why are most Linux programs written in C?

Why are most Linux programs written in C? Why are they not written with C++, which is newer?
hpn
  • 1,431
  • 7
  • 18
  • 21
33
votes
9 answers

Text editor for printing C++ code

I'm looking for an editor to print (on paper) C++ code. I'm currently in engineering school and the instructor has asked us to submit the code on paper. He wants name + surname, the class number (on header), the number of page at the bottom, and the…
loi219
  • 449
  • 4
  • 10
30
votes
1 answer

Difference between Cross GCC and Linux GCC toolchain

While creating new C++ Project in Eclipse, I am being asked about toolchain. What is the practical difference between these toolchains - Cross GCC and Linux GCC. In what circumstances use them? Does it have something to do with whether the project…
Wiktor
  • 455
  • 2
  • 5
  • 7
26
votes
6 answers

WSL 2 does not have /lib/modules/

I have the source code of a hello world kernel module that works in Ubuntu 20 in a laptop. Now I am trying to compile the same code in Ubuntu 20 but inside WSL2. For that I am using this: make -C /sys/modules/$(shell uname -r)/build M=$(PWD)…
23
votes
5 answers

How to install GCC 5 on debian jessie 8.1

I tried many solutions to install update for my gcc compiler on debian server. None of them worked. I need the compiler update to use new features of c++11, as this provides a stable libcxx11 ABI, and stable support for C++11 (refer here).…
mluthra
  • 331
  • 1
  • 2
  • 4
12
votes
4 answers

How to install latest stable release of GCC in Linux Mint?

I want to install the latest version of GCC (GNU compiler collection) in Linux Mint 17.3. Currently g++ --version returns 4.8.4, whereas the latest stable release is 5.3.
a06e
  • 1,627
  • 4
  • 24
  • 31
10
votes
2 answers

Why do I seem to lose data using this bash pipe construction?

I am trying to combine a few programs like so (please ignore any extra includes, this is heavy work-in-progress): pv -q -l -L 1 < input.csv | ./repeat <(nc "host" 1234) Where the source of the repeat program looks as follows: #include…
Roel Baardman
  • 203
  • 1
  • 5
10
votes
1 answer

C++ compile in Arch Linux with no g++ package in repositories

I want to compile a C++ program in Arch Linux, but there's no "g++" package as there is in Ubuntu repositories for example. Using -x too won't work. like this: gcc -x c++ -o myprog myprog.cpp
Haix64
  • 523
  • 1
  • 8
  • 18
8
votes
3 answers

How to install g++ 4.7.2 & c++11 on CentOS 5.x?

I'm trying to install the latest stable g++ and c++11. My host did it through yum install and thought that it was the latest, but it's not, and they are now saying that this is beyond their level of support. I've looked all over on how to do this,…
user31705
7
votes
1 answer

Fedora 27 /usr/bin/ld: cannot find -lstdc++

I have Fedora 27. I am building something from source. (It is https://github.com/xmrig/xmrig-nvidia if that matters). Make gets to linking and then fails with this message: /usr/bin/ld: cannot find -lstdc++ collect2: error: ld returned 1 exit…
Mikhail Ramendik
  • 442
  • 5
  • 18
7
votes
3 answers

Most common encoding for strings in C++ in Linux (and Unix?)

For creating a C++ program that is source code level portable between Windows and Linux and handles internationalization well, there are IMHO three main encodings to consider: The encoding of the C++ source code. The encoding of external data. The…
Alf P. Steinbach
  • 263
  • 2
  • 3
  • 8
7
votes
3 answers

System("pause") in Unix?

I normally use a debugger such as cgdb so I thankfully hadn't needed to resort to system calls for debugging, until now. I have a binary that takes around 30 minutes to load in gdb and frequently crashes the debugger thereafter, probably due to the…
quant
  • 4,061
  • 10
  • 34
  • 50
6
votes
1 answer

Why are there multiple copies of header files in /usr/include?

I've been browsing my /usr/include folder trying to get acquainted with the layout and I've noticed that there are multiple copies of header files (at least by name, I didn't actually diff them to see if they were exact copies) found in several sub…
Adam Sperry
  • 166
  • 2
  • 8
6
votes
1 answer

Why is my C++ program killed by OS

I've compiled small C++ application for school project on my virtual ubuntu 11.04. However when I attempt to run it over some larger data set after ~20 sec the program is killed by OS. Killed (SIGKILL) I need to find out why and remove the…
viktor
  • 163
  • 1
  • 1
  • 5
6
votes
1 answer

Why would one want to compile multiple .cpp files to the same executable?

Why would you do g++ -Wall -I/usr/local/include/thrift *.cpp -lthrift -o something instead of: g++ -Wall -I/usr/local/include/thrift -c Something.cpp -o something.o g++ -Wall -I/usr/local/include/thrift -c Something_server.cpp -o server.o g++…
algorithmicCoder
  • 263
  • 1
  • 2
  • 6
1
2 3
21 22