Sorry for the generic title, but I am no pro when it comes to C++ compiling and I can't seem to find the error here.
不好意思是通用标题,但是在c++编译方面我不是专业人士,我似乎找不到这里的错误。
I am checking out an official project, so I know that thing should actually compile just fine. It doesn't.
我正在检查一个正式的项目,所以我知道这个东西实际上应该编译得很好。它不是。
If somebody wants to checkout the code themselves, here you go:
如果有人想要自己检查代码,你可以这样做:
cvs -d :pserver:jvtuser:jvt.Amd.2@garcon.ient.rwth-aachen.de:/cvs/jvt login
cvs -d :pserver:jvtuser@garcon.ient.rwth-aachen.de:/cvs/jvt checkout jmvc
cd jmvc/JMVC/H264Extension/build/linux
make
When I call make
, I receive:
当我打电话给make时,我收到:
make -C lib/H264AVCVideoIoLib release
make[1]: Entering directory `/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib'
g++ -c -MMD -MF ./objects/H264AVCVideoIoLib.r.d -MT ./objects/H264AVCVideoIoLib.r.o -fPIC -DMSYS_LINUX -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DMSYS_UNIX_LARGEFILE -I/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include -I../../../../src/lib/H264AVCVideoIoLib -DMERL_VIEW -Wall -Wshadow -Wno-reorder -Wno-sign-compare -O3 -ffloat-store -DNDEBUG -Wuninitialized -o objects/H264AVCVideoIoLib.r.o /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp
In file included from /usr/include/c++/4.4/bits/stl_algo.h:61,
from /usr/include/c++/4.4/algorithm:62,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:56,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/usr/include/c++/4.4/bits/algorithmfwd.h:353: error: macro "max" passed 3 arguments, but takes just 2
/usr/include/c++/4.4/bits/algorithmfwd.h:364: error: macro "min" passed 3 arguments, but takes just 2
In file included from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h:9,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:9,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:45,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemAccessor.h: In member function ‘Void MemAccessList<T>::copyPayload(T*&, UInt&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemAccessor.h:207: error: ‘::memcpy’ has not been declared
In file included from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:9,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:45,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h: In copy constructor ‘MemCont<T>::MemCont(const MemCont<T>&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h:68: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h: In member function ‘MemCont<T>& MemCont<T>::operator=(const MemCont<T>&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h:113: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h: In member function ‘Void MemCont<T>::release(T*&, UInt&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemCont.h:221: error: ‘::memcpy’ has not been declared
In file included from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:45,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h: In copy constructor ‘MemList<T>::MemList(const MemList<T>&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:31: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h: In member function ‘MemList<T>& MemList<T>::operator=(const MemList<T>&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:68: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h: In member function ‘Void MemList<T>::release(T*&, UInt&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:129: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:151: error: ‘::memcpy’ has not been declared
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h: In member function ‘Void MemList<T>::release(T*&, UInt&, T*&, UInt&)’:
/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/MemList.h:181: error: ‘::memcpy’ has not been declared
In file included from /usr/include/c++/4.4/bits/stl_algo.h:61,
from /usr/include/c++/4.4/algorithm:62,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:56,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/usr/include/c++/4.4/bits/algorithmfwd.h: At global scope:
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected unqualified-id before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:349: error: expected initializer before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:353: error: template declaration of ‘const _Tp& std::max’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected unqualified-id before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected ‘)’ before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:360: error: expected initializer before ‘const’
/usr/include/c++/4.4/bits/algorithmfwd.h:364: error: template declaration of ‘const _Tp& std::min’
In file included from /usr/include/c++/4.4/algorithm:62,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCCommonIf.h:56,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../include/H264AVCVideoIoLib.h:5,
from /home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib/../../../../src/lib/H264AVCVideoIoLib/H264AVCVideoIoLib.cpp:2:
/usr/include/c++/4.4/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance)’:
/usr/include/c++/4.4/bits/stl_algo.h:3239: error: expected unqualified-id before ‘(’ token
/usr/include/c++/4.4/bits/stl_algo.h: In function ‘void std::__merge_sort_loop(_RandomAccessIterator1, _RandomAccessIterator1, _RandomAccessIterator2, _Distance, _Compare)’:
/usr/include/c++/4.4/bits/stl_algo.h:3263: error: expected unqualified-id before ‘(’ token
make[1]: *** [objects/H264AVCVideoIoLib.r.o] Error 1
make[1]: Leaving directory `/home/user/JMVC/jmvc/JMVC/H264Extension/build/linux/lib/H264AVCVideoIoLib'
make: *** [release] Error 2
Just fyi, I'm using g++:
我用的是g++
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
... and gcc:
…和gcc:
Using built-in specs.
Target: i686-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.4.4-14ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.4 --enable-shared --enable-multiarch --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.4 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-targets=all --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=i686-linux-gnu --host=i686-linux-gnu --target=i686-linux-gnu
Thread model: posix
gcc version 4.4.5 (Ubuntu/Linaro 4.4.4-14ubuntu5)
I'd be very thankful if somebody had some pointers...
如果有人能给我一些建议,我会很感激的。
2 个解决方案
#1
3
C++'s standard library does not use or define max
or min
as macros. The line where the first error is reported (/usr/include/c++/4.4/bits/algorithmfwd.h:353
) contains a forward declaration for the std::max template function with a third parameter. From what I can see in the infos you gave, I'd reckon that on your system some old header is included, which defines max()
and min()
as macros. A common problem, by the way.
c++的标准库不使用或定义max或min作为宏。报告第一个错误的行(/usr/include/c++/4.4/bits/algorithmfwd.h:353)包含std::max模板函数的正向声明,其中包含第三个参数。从您提供的信息中我可以看到,我估计您的系统中包含了一些旧的header,它将max()和min()定义为宏。顺便说一句,这是一个常见的问题。
You'll need to identify the header (or source file) which defines max
/min
and try to figure out if there is a way to configure the source code to build without that header.
您需要识别定义max/min的头(或源文件),并尝试找出是否有一种方法可以配置源代码,使其在没有头的情况下构建。
UPDATE: Looks like the culprits are in the source files:
更新:看起来罪魁祸首在源文件中:
> grep -R "#define min" *
include/DownConvertTools.inl:#define min(x, y) ((x)<(y)?(x):(y))
include/H264AVCCommonLib/GlobalFunctions.h:#define min(x,y) ((x)<(y)?(x):(y))
include/H264AVCCommonIf.h:#define min(x,y) ((x)<(y)?(x):(y))
src/test/H264AVCDecoderLibTest/DecoderParameter.h:#define min(x,y) (((x) < (y)) ? (x) : (y))
src/lib/H264AVCCommonLib/CFMO.cpp://#define min(a,b) ((a)>(b))?b:a
Duplicated definitions usually mean that the code needs cleanup anyway, so you could start by removing the macros and replacing max
/min
with std::max
/std::min
.
重复的定义通常意味着代码无论如何都需要清理,所以您可以从删除宏开始,然后用std::max/std::min替换max/min。
#2
4
The ddraw.lib is actually not used by the software, so you can safely remove ddraw.lib from the list of libraries linker used and the solution will build successfully.
ddraw。实际上这个软件并没有使用lib,所以您可以安全地删除ddraw。使用的库链接器列表中的lib,解决方案将成功构建。
#1
3
C++'s standard library does not use or define max
or min
as macros. The line where the first error is reported (/usr/include/c++/4.4/bits/algorithmfwd.h:353
) contains a forward declaration for the std::max template function with a third parameter. From what I can see in the infos you gave, I'd reckon that on your system some old header is included, which defines max()
and min()
as macros. A common problem, by the way.
c++的标准库不使用或定义max或min作为宏。报告第一个错误的行(/usr/include/c++/4.4/bits/algorithmfwd.h:353)包含std::max模板函数的正向声明,其中包含第三个参数。从您提供的信息中我可以看到,我估计您的系统中包含了一些旧的header,它将max()和min()定义为宏。顺便说一句,这是一个常见的问题。
You'll need to identify the header (or source file) which defines max
/min
and try to figure out if there is a way to configure the source code to build without that header.
您需要识别定义max/min的头(或源文件),并尝试找出是否有一种方法可以配置源代码,使其在没有头的情况下构建。
UPDATE: Looks like the culprits are in the source files:
更新:看起来罪魁祸首在源文件中:
> grep -R "#define min" *
include/DownConvertTools.inl:#define min(x, y) ((x)<(y)?(x):(y))
include/H264AVCCommonLib/GlobalFunctions.h:#define min(x,y) ((x)<(y)?(x):(y))
include/H264AVCCommonIf.h:#define min(x,y) ((x)<(y)?(x):(y))
src/test/H264AVCDecoderLibTest/DecoderParameter.h:#define min(x,y) (((x) < (y)) ? (x) : (y))
src/lib/H264AVCCommonLib/CFMO.cpp://#define min(a,b) ((a)>(b))?b:a
Duplicated definitions usually mean that the code needs cleanup anyway, so you could start by removing the macros and replacing max
/min
with std::max
/std::min
.
重复的定义通常意味着代码无论如何都需要清理,所以您可以从删除宏开始,然后用std::max/std::min替换max/min。
#2
4
The ddraw.lib is actually not used by the software, so you can safely remove ddraw.lib from the list of libraries linker used and the solution will build successfully.
ddraw。实际上这个软件并没有使用lib,所以您可以安全地删除ddraw。使用的库链接器列表中的lib,解决方案将成功构建。