不能重载仅 return 类型不同的函数
Functions that differ only in their return type cannot be overloaded
注意:虽然问题是重复的,但目前的答案缺乏细节,所以我想post另一个。
我正在使用由 Embarcadero 开发的 C++Builder。
对于 Windows,编译正常。
对于Android,显示如下错误:
Checking project dependencies...
Building Project3.cbproj (Debug, Android)
bccaarm command line for "Project3PCH1.h"
c:\program files\embarcadero\studio.0\bin\bccaarm.exe -cc1 -D _DEBUG -output-dir .\Android\Debug -isysroot
C:\Microsoft\AndroidNDK\android-ndk-r15c\sysroot -idirafter =\usr\include -idirafter =\usr\include\arm-linux-androideabi -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\cxx-stl\gnu-libstdc++.9\include -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\cxx-stl\gnu-libstdc++.9\libs\armeabi-v7a\include -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\android\native_app_glue -I C:\Users\gray\Documents\Embarcadero\Studio\Projects -I "c:\program
files\embarcadero\studio.0\include\android\fmx" -isystem "c:\program files\embarcadero\studio.0\include" -isystem "c:\program
files\embarcadero\studio.0\include\android\rtl" -isystem "c:\program files\embarcadero\studio.0\include\android\fmx" -isystem "c:\program
files\embarcadero\studio.0\include\android\crtl" -isystem C:\Users\Public\Documents\Embarcadero\Studio.0\hpp\Android
-debug-info-kind=standalone -fborland-extensions -fborland-auto-refcount -nobuiltininc -nostdsysteminc -triple thumbv7-none-linux-androideabi
-emit-pch -mconstructor-aliases -masm-verbose -target-abi aapcs-linux -target-cpu cortex-a8 -nostdinc++ -fdeprecated-macro -fexceptions
-fcxx-exceptions -munwind-tables -mstackrealign -fno-spell-checking -x c++ -std=c++11 -O0 -fmath-errno -tU -o .\Android\Debug\Project3PCH1.pch
Project3PCH1.h
[bccaarm Error] string.h(664): functions that differ only in their return type cannot be overloaded
string.h(50): previous declaration is here
[bccaarm Error] string.h(680): functions that differ only in their return type cannot be overloaded
string.h(69): previous declaration is here
[bccaarm Error] string.h(697): functions that differ only in their return type cannot be overloaded
string.h(89): previous declaration is here
[bccaarm Error] string.h(711): functions that differ only in their return type cannot be overloaded
string.h(118): previous declaration is here
[bccaarm Error] string.h(729): functions that differ only in their return type cannot be overloaded
string.h(155): previous declaration is here
Failed
Elapsed time: 00:00:18.3
我敢打赌,您需要在代码中使用“预处理器指令”并指明平台
How do I check OS with a preprocessor directive?
注意:虽然问题是重复的,但目前的答案缺乏细节,所以我想post另一个。
我正在使用由 Embarcadero 开发的 C++Builder。
对于 Windows,编译正常。
对于Android,显示如下错误:
Checking project dependencies...
Building Project3.cbproj (Debug, Android)
bccaarm command line for "Project3PCH1.h"
c:\program files\embarcadero\studio.0\bin\bccaarm.exe -cc1 -D _DEBUG -output-dir .\Android\Debug -isysroot
C:\Microsoft\AndroidNDK\android-ndk-r15c\sysroot -idirafter =\usr\include -idirafter =\usr\include\arm-linux-androideabi -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\cxx-stl\gnu-libstdc++.9\include -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\cxx-stl\gnu-libstdc++.9\libs\armeabi-v7a\include -idirafter
C:\Microsoft\AndroidNDK\android-ndk-r15c\sources\android\native_app_glue -I C:\Users\gray\Documents\Embarcadero\Studio\Projects -I "c:\program
files\embarcadero\studio.0\include\android\fmx" -isystem "c:\program files\embarcadero\studio.0\include" -isystem "c:\program
files\embarcadero\studio.0\include\android\rtl" -isystem "c:\program files\embarcadero\studio.0\include\android\fmx" -isystem "c:\program
files\embarcadero\studio.0\include\android\crtl" -isystem C:\Users\Public\Documents\Embarcadero\Studio.0\hpp\Android
-debug-info-kind=standalone -fborland-extensions -fborland-auto-refcount -nobuiltininc -nostdsysteminc -triple thumbv7-none-linux-androideabi
-emit-pch -mconstructor-aliases -masm-verbose -target-abi aapcs-linux -target-cpu cortex-a8 -nostdinc++ -fdeprecated-macro -fexceptions
-fcxx-exceptions -munwind-tables -mstackrealign -fno-spell-checking -x c++ -std=c++11 -O0 -fmath-errno -tU -o .\Android\Debug\Project3PCH1.pch
Project3PCH1.h
[bccaarm Error] string.h(664): functions that differ only in their return type cannot be overloaded
string.h(50): previous declaration is here
[bccaarm Error] string.h(680): functions that differ only in their return type cannot be overloaded
string.h(69): previous declaration is here
[bccaarm Error] string.h(697): functions that differ only in their return type cannot be overloaded
string.h(89): previous declaration is here
[bccaarm Error] string.h(711): functions that differ only in their return type cannot be overloaded
string.h(118): previous declaration is here
[bccaarm Error] string.h(729): functions that differ only in their return type cannot be overloaded
string.h(155): previous declaration is here
Failed
Elapsed time: 00:00:18.3
我敢打赌,您需要在代码中使用“预处理器指令”并指明平台
How do I check OS with a preprocessor directive?