小编Bob*_*bby的帖子

clang 3.8 make文件失败

在我挠了头3个多小时后,我终于放弃了,决定请你们帮忙.

我有一些文件,它们将编译成一个可执行文件.

随着-stdlib=libc++ flag,我会得到

/usr/include/c++/v1/string:1938:44: error: 'basic_string<_CharT, _Traits, _Allocator>' is missing exception specification 'noexcept(is_nothrow_copy_constructible<allocator_type>::value)'
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
                                           ^
/usr/include/c++/v1/string:1326:40: note: previous declaration is here
    _LIBCPP_INLINE_VISIBILITY explicit basic_string(const allocator_type& __a)
Run Code Online (Sandbox Code Playgroud)

我做了一些搜索,而另一个问题则是疑问.更改为 -stdlib=libstdc++,我在控制台中获得了大量输出.

/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:382: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:382: undefined reference to `std::allocator<char>::~allocator()'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:382: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::~basic_string()'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:382: undefined reference to `std::allocator<char>::~allocator()'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:399: undefined reference to `std::allocator<char>::allocator()'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:399: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)'
/home/bobby/Documents/freshmen/225/cs225/lab_intro/png.cpp:399: undefined …
Run Code Online (Sandbox Code Playgroud)

c++ clang c++11

6
推荐指数
1
解决办法
718
查看次数

Iterm2路径颜色设置

我曾经是一个ubuntu用户,但最近改用了Mac.我真的想配置iterm2的colorscheme尽可能看起来像ubuntu默认终端.

最大的问题是我无法配置当前路径的颜色.在Ubuntu中,它就像在此输入图像描述

但是,在iterm2中,当我改变前景时,bobby laptop name~/Documents它们是相同的颜色.这真的很烦人.查看与机器名称纠缠在一起的文件路径真的很痛苦.

macos terminal colors iterm2

5
推荐指数
1
解决办法
3532
查看次数

如何捕获Android Firebase signUpWithEmailAndPassword错误代码?

我在线阅读JavaScript文档,您可以捕获从createUserWithEmailAndPassword函数返回的错误代码,以确定它是否已经使用过电子邮件,密码太弱等等.我如何在Java中执行此操作?

这在JavaScript中可以告诉它是什么错误.

firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
  // Handle Errors here.
  var errorCode = error.code;
  var errorMessage = error.message;
  // ...
});
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication

4
推荐指数
1
解决办法
1209
查看次数

Android将firebase auth对象传递给另一个活动以退出

我在主要活动中登录用户,但我想通过按钮注销另一个活动中的用户.但是,我无法将FirebaseAuth对象传递给其他活动.

PutParcelable和PutSerializable不起作用,因为我无法控制类本身.共享首选项仅接受原始类型.我是否应该在新活动中获得新实例并在新活动中注销用户?即使我得到一个新实例,用户的状态是否会被保留?

这是代码

mAuth = FirebaseAuth.getInstance();
        mAuthListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser user = firebaseAuth.getCurrentUser();
                if (user != null) {
                    // User is signed in
                    Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
                    Toast.makeText(getApplicationContext(), "You are logged in!!!",
                            Toast.LENGTH_SHORT).show();
                    Intent intent = new Intent(MainActivity.this, CameraActivity.class);

                    startActivity(intent);
                } else {
                    // User is signed out
                    Log.d(TAG, "onAuthStateChanged:signed_out");
                }

            }
        };
Run Code Online (Sandbox Code Playgroud)

authentication android firebase firebase-authentication

3
推荐指数
1
解决办法
3720
查看次数

python正则表达式匹配不正确

我有一个字符串

"aaabbbbccc"

我想找回 ["aaa", "bbbb", "ccc"]

根据这篇文章 什么正则表达式可以匹配相同字符的序列?

In [8]: re.findall('(\w)\1+', s)
Out[8]: []
Run Code Online (Sandbox Code Playgroud)

我想我使用在线正则表达式解析器成功检索到了这个模式。

python regex

2
推荐指数
1
解决办法
235
查看次数

非常简单的C++程序内存泄漏

在一个非常简单的C++程序中,我一直在研究这个内存泄漏问题.我正确地删除了唯一的指针分配但仍然发生了大量的内存泄漏.我的课程都没有变数.

所有方法只打印一个sinple硬编码字符串

主要

#include <iostream>
#include "queen.h"
#include "piece.h"
using namespace std;

void printPiece(piece *p) {
  cout<<"In printPiece, printType() of the same memory address is:"<<endl;
  p->printType();
}

int main() {
  queen *q = new queen();

  cout<<"In main, printType() of queen *q is:"<<endl;
  q->printType();

  printPiece(q);

  delete q;
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

片类

#ifndef _PIECE_H
#define _PIECE_H

class piece {
public:
    void printType();
};

#endif
Run Code Online (Sandbox Code Playgroud)

女王

#ifndef _QUEEN_H
#define _QUEEN_H
#include "piece.h"

class queen : public piece{
  public:
    void printType();
};

#endif
Run Code Online (Sandbox Code Playgroud)

Valgrind在MacOS上 …

c++ memory-leaks

-1
推荐指数
1
解决办法
130
查看次数