Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B
Can't compile debuggergdb.o on Mac OS Yosemite!
Easior Lars:
Hello, everyone.
It's well-known that the binary ball of Code::Blocks on Mac OS is out-of-date. Some bugs are needed to be fixed. e.g. Changing the font of Editor in Code::Blocks makes it crash. Hence I try to build Code::Blocks from source codes on Mac OS Yosemite.
Firstly, I install wxmac by homebrew and download codeblocks_13.12-1.tar.gz from SF.net and unpack it somewhere. Following the instructions on http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Mac_OS_X and applying some patches, then I run the following command lines in the terminal:
--- Code: ---$ mkdir cocobuild & cd cocobuild
$ ../configure --prefix="${HOME}/Developer/CodeBlocks" --with-contrib-plugins="yes,-FileManager,-NassiShneiderman,-spellchecker" CXXFLAGS='-D _WCHAR_H_CPLUSPLUS_98_CONFORMANCE_'
$ make
--- End code ---
It is no lucky for me. The debuggergdb plugin is failed to compile with the following error:
--- Code: ---../../../../src/include/prep.h:33:75: error: use of overloaded operator '==' is ambiguous (with operand types 'const std::__1::shared_ptr<GDBWatch>' and 'int')
template<typename T> bool equals(T const& rhs) const { return rhs == 0; }
~~~ ^ ~
../../../../src/include/prep.h:44:99: note: in instantiation of function template specialization 'nullptr_t::equals<std::__1::shared_ptr<GDBWatch> >' requested here
template<typename T> inline bool operator==(T const& lhs, const nullptr_t& rhs) { return rhs.equals(lhs); }
^
../../../../src/plugins/debuggergdb/debuggergdb.cpp:501:27: note: in instantiation of function template specialization 'operator==<std::__1::shared_ptr<GDBWatch> >' requested here
if (m_localsWatch == nullptr)
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/memory:4765:1: note: candidate function [with _Tp = GDBWatch]
operator==(const shared_ptr<_Tp>& __x, nullptr_t) _NOEXCEPT
^
../../../../src/include/prep.h:33:75: note: built-in candidate operator==(int, int)
template<typename T> bool equals(T const& rhs) const { return rhs == 0; }
--- End code ---
Anyone know what happened?
oBFusCATed:
There is a declaration of nullptr_t class in prep.h.
You'll have to check if the conditionals are correct for you compiler.
I guess it should detect that this feature is present in clang and not use it.
Probably #include <stddef.h> is missing and should be added in an else clause.
Easior Lars:
--- Quote from: oBFusCATed on June 10, 2015, 08:41:57 am ---There is a declaration of nullptr_t class in prep.h.
You'll have to check if the conditionals are correct for you compiler.
I guess it should detect that this feature is present in clang and not use it.
Probably #include <stddef.h> is missing and should be added in an else clause.
--- End quote ---
You are right about the existence of the conditionals in prep.h, however there isn't an else clause. In fact, the codes you mentioned are as follows:
--- Code: ---#if !(__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined __GXX_EXPERIMENTAL_CXX0X__) \
&& !(defined(__clang__) && __has_feature(cxx_nullptr))
// it is a const object...
const class nullptr_t
{
public:
// constructor
nullptr_t() {}
// convertible to any type of null non-member pointer...
template<typename T> operator T* () const{ return (T*)0; }
// or any type of null member pointer...
template<typename C, typename T> operator T C::* () const { return (T C::*)0; }
// support operator overloading (== and !=)
template<typename T> bool equals(T const& rhs) const { return rhs == 0; }
private:
// can't take address of nullptr
void operator&() const;
// can't copyable
nullptr_t(const nullptr_t&);
const nullptr_t& operator=(const nullptr_t&);
} nullptr_;
#define nullptr nullptr_
template<typename T> inline bool operator==(const nullptr_t& lhs, T const& rhs) { return lhs.equals(rhs); }
template<typename T> inline bool operator==(T const& lhs, const nullptr_t& rhs) { return rhs.equals(lhs); }
template<typename T> inline bool operator!=(const nullptr_t& lhs, T const& rhs) { return !lhs.equals(rhs); }
template<typename T> inline bool operator!=(T const& lhs, const nullptr_t& rhs) { return !rhs.equals(lhs); }
#endif
--- End code ---
It's unfortunate that I can't figure out where the #include <stddef.h> should be added. In other words, I don't know how to fix it.
Could you tell me how to check if the conditionals are correct for my compiler?
oBFusCATed:
Place an #error line inside the conditionals.
One thing you could do to verify that this is causing the problem is to include stddef.h/cstddef.h in the cpp file fails to compile.
Easior Lars:
--- Quote from: oBFusCATed on June 10, 2015, 08:41:57 am ---There is a declaration of nullptr_t class in prep.h.
You'll have to check if the conditionals are correct for you compiler.
I guess it should detect that this feature is present in clang and not use it.
--- End quote ---
I have known what happened. Clang++ is the default compiler of Xcode 6 on Mac OS. There are some different implements of shared_ptr under different C++ standards. For compiling debuggergdb.o, CXXFLAGS="-std=c++11" is needed.
Navigation
[0] Message Index
[#] Next page
Go to full version