Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling errors in Centos 7.9 #252

Open
lucien2016 opened this issue Apr 7, 2023 · 6 comments
Open

Compiling errors in Centos 7.9 #252

lucien2016 opened this issue Apr 7, 2023 · 6 comments

Comments

@lucien2016
Copy link

make
make -C src -f MakeApp.mk decpcap_test
make[1]: Entering directory /tmp/nethogs-0.8.7/src' cc -Wall -Wextra -c decpcap.c g++ -Wall -Wextra -Wno-missing-field-initializers decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm make[1]: Leaving directory /tmp/nethogs-0.8.7/src'
make -C src -f MakeApp.mk test
make[1]: Entering directory /tmp/nethogs-0.8.7/src' g++ -Wall -Wextra -Wno-missing-field-initializers conninode_test.cpp -o conninode_test for test in conninode_test; do echo $test ; ./$test ; done conninode_test make[1]: Leaving directory /tmp/nethogs-0.8.7/src'
make -C src -f MakeApp.mk nethogs
make[1]: Entering directory /tmp/nethogs-0.8.7/src' g++ -Wall -Wextra -Wno-missing-field-initializers -c packet.cpp packet.cpp: In member function ‘Packet Packet::onlySource() const’: packet.cpp:310:13: error: ‘begin’ is not a member of ‘std’ std::fill(std::begin(p.dip6.s6_addr), std::end(p.dip6.s6_addr), 0); ^ packet.cpp:310:41: error: ‘end’ is not a member of ‘std’ std::fill(std::begin(p.dip6.s6_addr), std::end(p.dip6.s6_addr), 0); ^ make[1]: *** [packet.o] Error 1 make[1]: Leaving directory /tmp/nethogs-0.8.7/src'
make: *** [nethogs] Error 2

@raboof
Copy link
Owner

raboof commented Apr 7, 2023

These seem to have been there since C++98. What g++ version are you using?

I see you are building version 0.8.7. Do you have the same problem on latest main?

@lucien2016
Copy link
Author

last main
[root@xxxx nethogs-main]# make
make -C src -f MakeApp.mk decpcap_test
make[1]: Entering directory /tmp/nethogs-main/src' g++ -Wall -Wextra -Wno-missing-field-initializers -std=c++14 decpcap_test.cpp decpcap.o -o decpcap_test -lpcap -lm g++: error: unrecognized command line option ¡-std=c++14¡¯ make[1]: *** [decpcap_test] Error 1 make[1]: Leaving directory /tmp/nethogs-main/src'
make: *** [decpcap_test] Error 2

@raboof
Copy link
Owner

raboof commented Apr 7, 2023

OK, does that mean you have a version of G++ that does not support c++14 yet? You didn't mention what version of g++ you are using.

@lucien2016
Copy link
Author

g++ --version
g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

centos 7.9 default is 4.8.5

@raboof
Copy link
Owner

raboof commented Apr 7, 2023

OK, from https://gcc.gnu.org/projects/cxx-status.html#cxx14 it looks like c++14 is only fully supported since g++ 5.

@fanxiao92
Copy link

first install blew package

sudo yum install -y centos-release-scl
sudo yum install -y devtoolset-7

then add blew content to Makefile head

export CC=/opt/rh/devtoolset-7/root/usr/bin/gcc
export CXX=/opt/rh/devtoolset-7/root/usr/bin/g++

last run make command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants