change the way build c++ code

when building my project with Xcode16 Beta, I came across several compile errors in c++ code, which used to be ok when building with Xcode15. It's not easy to fix them because some of them came from third part libraries. Is there a way to configure Xcode to build c++ code conforming to the Xcode 15 manner? (I know I can get back to Xcode15 temporarily, but I worry these issue can not be fixed even in the official release version)

Answered by DTS Engineer in 794249022

It’s hard to offer concrete advice without more details about the exact error. However, in general, Xcode has a C++ Language Dialect build setting that controls the version of C++ that it uses, and you’ll want to make sure that your code is consistent with that setting.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Same.... I get compiler errors in structs with std::strings, which were fine in Xcode 15

It’s hard to offer concrete advice without more details about the exact error. However, in general, Xcode has a C++ Language Dialect build setting that controls the version of C++ that it uses, and you’ll want to make sure that your code is consistent with that setting.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

compile error happen when I use c++ template. it is from a third part library.

there is a template class case_wrapper_base, when I create a instance with the type int, there will be compile error, complaining that const type can not use default initialization.

template <class CT>
class case_wrapper_base
{
public:
    explicit case_wrapper_base(const CT& v) : check(v), default_step(nullptr) {}


    case_wrapper_base& add_entry(const case_instruction& lambda_holder)
    {
        steps.push_back(&lambda_holder);
        return *this;
    }

    case_wrapper_base& add_default(const case_instruction& lambda_holder)
    {
        default_step = &lambda_holder;
        return *this;
    }

    case_wrapper_base& join()
    {
        return *this;
    }

    void run() const
    {
        auto it = steps.begin();
        while(it != steps.end())
        {
            bool increased = false;
            // error happens due to the two different type here
            if(dynamic_cast<const branch<CT>*>(*it) || dynamic_cast<const branch<const CT>*>(*it))
  // do something. not important
}

the definition of class branch is

template<class CT>
class branch final : public case_instruction
{
public:
    template<class T>
    branch(T lambda) {condition.reset(new any_functor<T>(lambda));}

    bool equals(const base_rvholder& rv, CT lv) const
    {
        return rv.equals(lv);
    }

    virtual next_step execute(const base_rvholder& against) const override
    {
    // there is compile error here. Default initialization of an object of const type 'const int'. I know it is because the type of `CT`  become `const int`. but why there is no error  when build with Xcode15.  can I make it no error by adding some settings in Xcode16?
        CT retv; 
        condition->run( const_cast<void*>(reinterpret_cast<const void*>(&retv) ) );
        return equals(against,retv) ? next_step::ns_done : next_step::ns_continue;
    }

private:
    std::unique_ptr<any_functor_base> condition;
};

@DTS Engineer appreciate your reply.

change the way build c++ code
 
 
Q