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

solve: Compile error when g++ version is less than 5 #70

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

solve: Compile error when g++ version is less than 5 #70

wants to merge 3 commits into from

Conversation

qq624758472
Copy link

@qq624758472 qq624758472 commented Sep 3, 2021

Compile error when g++ version is less than 5

log:
[root@localhost lshw]# make make -C src all make[1]: 进入目录“/root/lshw/src” make -C core all make[2]: 进入目录“/root/lshw/src/core” g++ -g -Wall -g -I./core/ -DPREFIX=\"/usr\" -DSBINDIR=\"/usr/sbin\" -DMANDIR=\"/usr/share/man\" -DDATADIR=\"/usr/share\" -DVERSION=\"B.02.19.60\" -c hw.cc -o hw.o hw.cc: 在成员函数‘long long int hw::value::asInteger() const’中: hw.cc:2462:38: 错误:不能将‘long long int strtoll(const char*, char**, int)’的实参‘1’从‘std::string {aka std::basic_string<char>}’转换到‘const char*’ return strtoll(This->s, NULL, 0); ^ make[2]: *** [hw.o] 错误 1 make[2]: 离开目录“/root/lshw/src/core” make[1]: *** [core] 错误 2 make[1]: 离开目录“/root/lshw/src” make: *** [all] 错误 2

@qq624758472 qq624758472 changed the title solve: Compile error when gcc version is less than 5 solve: Compile error when g++ version is less than 5 Sep 3, 2021
@qq624758472
Copy link
Author

Compile ok.

[root@localhost lshw]# g++ -v
使用内建 specs。
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.8.5/lto-wrapper
目标:x86_64-redhat-linux
配置为:../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.5-20150702/obj-x86_64-redhat-linux/cloog-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux
线程模型:posix
gcc 版本 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC)
[root@localhost lshw]# make
make -C src all
make[1]: 进入目录“/root/lshw/src”
make -C core all
make[2]: 进入目录“/root/lshw/src/core”
make[2]: 对“all”无需做任何事。
make[2]: 离开目录“/root/lshw/src/core”
g++ -L./core/ -g -Wl,--as-needed -o lshw lshw.o -llshw -lresolv
make[1]: 离开目录“/root/lshw/src”
[root@localhost lshw]# ls
COPYING docs lshw.spec.in Makefile README.md src
[root@localhost lshw]# ls src/
core gui jedec.ods lshw lshw.1 lshw.cc lshw.o lshw.sgml mac-prefixes Makefile manuf.txt oui.txt pci.ids pnp.ids pnpid.txt po usb.ids
[root@localhost lshw]#

@ffontaine
Copy link

I can confirm that this PR is needed to fix the following build failure with gcc 4.8.3:

hw.cc: In member function 'long long int hw::value::asInteger() const':
hw.cc:2462:36: error: 'stoll' was not declared in this scope
       return stoll(This->s, NULL, 0);
                                    ^

Full build log: http://autobuild.buildroot.org/results/162/162e438e3f9aab9310fdbc3cf7529144ce7cb50e/build-end.log

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

Successfully merging this pull request may close these issues.

2 participants