小编Dai*_*air的帖子

颤动无法找到Android SDK

flutter通过AUR安装了.我也aur/android-sdk 26.0.2-1安装了.当我跑步时,flutter run我得到:

Warning! This package referenced a Flutter repository via the .packages file that is
no longer available. The repository from which the 'flutter' tool is currently
executing will be used instead.
  running Flutter tool: /home/dair/.flutter-sdk
  previous reference  : /home/dair/flutter
This can happen if you deleted or moved your copy of the Flutter repository, or
if it was on a volume that is no longer mounted or has been mounted …
Run Code Online (Sandbox Code Playgroud)

android flutter

16
推荐指数
10
解决办法
3万
查看次数

用pip3问题安装孔雀鱼

我正在尝试安装孔雀鱼.我的程序使用python3所以我必须使用pip3.当我跑:

pip3 install guppy
Run Code Online (Sandbox Code Playgroud)

我明白了:

src/sets/sets.c:77:1: error: expected function body after function declarator
INITFUNC (void)
^
src/sets/sets.c:39:18: note: expanded from macro 'INITFUNC'
#define INITFUNC initsetsc
                 ^
1 error generated.
error: command 'clang' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)

我尝试过做这个,甚至thourgh这是不一样的,并远销gcc和g ++:

?  ~ export CC=gcc
?  ~ export CXX=g++
Run Code Online (Sandbox Code Playgroud)

再跑一次:

src/sets/sets.c:77:1: error: expected function body after function declarator
INITFUNC (void)
^
src/sets/sets.c:39:18: note: expanded from macro 'INITFUNC'
#define INITFUNC initsetsc
                 ^
1 error generated.
error: command 'gcc' failed …
Run Code Online (Sandbox Code Playgroud)

python python-3.x

15
推荐指数
2
解决办法
9304
查看次数

错误代码枚举的C命名建议

我正在编写一个简单的解析器来读取配置文件.config.h接口只有三个主要功能,简要如下,

config_init();
config_dinit();
config_parse();
config_read_value();
Run Code Online (Sandbox Code Playgroud)

我的问题是那些函数会发出不同类型的错误,例如,

config_init() emit , FILE_NOT_FOUND,FILE_EOF_ERROR,FILE_OPEN_ERROR, ...
config_dinit() emit , NOT_INIT_ERROR ,
config_parse() emit , PARSE_ERROR, OVERFLOW_ERROR, INVALID_CHARACTER_FOUND_ERROR,...
config_read_value() emit, SECTION_NOT_FOUND,KEYWORD_NOT_FOUND,OVERFLOW_ERROR,NOT_INITIALIZED_ERROR,INVALID_STATE_ERROR,... etc.

Then I create enums for each function, for by using these names , 
enum Config_ParseError{...} , enum Config_InitError{...} ,enum Config_ReadValueError{..}
etc.
Run Code Online (Sandbox Code Playgroud)

一些枚举值相互重叠,也会出现"编译错误".喜欢OVERFLOW_ERROR,

我正在打开你的建议,

我已经对谷歌进行了快速研究,发现最流行的IRC客户端源代码定义了这样的枚举,

enum {
    CMDERR_OPTION_UNKNOWN = -3, /* unknown -option */
    CMDERR_OPTION_AMBIGUOUS = -2, /* ambiguous -option */
    CMDERR_OPTION_ARG_MISSING = -1, /* argument missing for -option */

    CMDERR_UNKNOWN, /* unknown command */ …
Run Code Online (Sandbox Code Playgroud)

c enums naming

10
推荐指数
1
解决办法
1万
查看次数

#include <vector>没有这样的文件或目录

所以我需要在我的项目中使用向量.我已将.m文件更改为.mm以使其成为Objective-C++.但是,当我试着说:

#include <vector>
Run Code Online (Sandbox Code Playgroud)

在我的.h中,它说无法找到文件或目录.如果我把那行代码放在我的.mm文件中虽然没有出现错误,但是因为我需要一个向量@interface(在我的.h中)我该怎么办才能使.h文件找到向量文件?

此外,我已经尝试将其更改为将所有内容编译为Objective-C++,但这不起作用,因为我在使用的Cocos2d库中出现了一些错误...

iphone stl objective-c++

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

无法理解Haskell的类型系统

我目前正在尝试做20次中级Haskell练习.我能够完成前3个练习(但这是因为furry== fmap并且了解你,Haskell已经有了这些实现).我目前卡在那个说:

instance Fluffy (EitherLeft t) where                                        
  furry = error "todo"
Run Code Online (Sandbox Code Playgroud)

我真的不明白该怎么做.在Learn You Haskell中,他们有一个newtype变量Pair,它接受一个元组.然后他们可以进行模式匹配:

  fmap f (Pair (x,y)) = Pair (f x, y)
Run Code Online (Sandbox Code Playgroud)

我想也许你可以在我的情况下做类似的事情:

  furry f (EitherLeft (Either a b)) = EitherLeft (Either (f a) b)
Run Code Online (Sandbox Code Playgroud)

但是,这不起作用:

Not in scope: data constructor `Either'
Run Code Online (Sandbox Code Playgroud)

我想也许我愿意,import Data.Either因为可能有一些他没有的重要东西.但那没关系.

我也尝试让这个工作:

  furry f (EitherLeft a b) = error "todo"
Run Code Online (Sandbox Code Playgroud)

但这也不起作用:

Constructor `EitherLeft' should have 1 argument, but has been given 2
Run Code Online (Sandbox Code Playgroud)

我无法让这个工作: …

constructor haskell types overloading algebraic-data-types

8
推荐指数
1
解决办法
841
查看次数

"for L in item"循环中的语法无效

我有一种感觉,我错过了一些非常简单的东西,但在这一个功能中:

def triplets(perimeter):

    triplets, n, a, b, c = 0  #number of triplets, a, b, c, sides of a triangle, n is used to calculate a triple
    L = primes(int(math.sqrt(perimeter)) #list of primes to divide the perimeter

    for item in L: #iterate through the list of primes
        if perimeter % item == 0: #check if a prime divides the perimeter
            n = perimeter / item
            a = n**2 - (n+1)**2 #http://en.wikipedia.org/wiki/Pythagorean_triple
            b = 2n*(n+1)
            c = n**2 + n**2
            if …
Run Code Online (Sandbox Code Playgroud)

python

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

使用默认参数Boost Python包装静态成员函数重载

我有python的附加C++包装器示例:成员函数(方法)是静态的,带有默认参数.所以我使用BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS来定义重载函数.没有编译错误,但是当我调用静态成员函数时,我得到了如下错误:

import boostPythonTest    
boostPythonTest.C.method("string")
Run Code Online (Sandbox Code Playgroud)
---------------------------------------------------------------------------  ArgumentError Traceback (most recent call last)
<ipython-input-4-ab141804179c> in <module>()
----> 1 boostPythonTest.C.method("string")

ArgumentError: Python argument types in
C.method(str) did not match C++ signature:

method(class C {lvalue}, class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >)

method(class C {lvalue}, class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >, int)

method(class C {lvalue}, class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> >, int, bool)
Run Code Online (Sandbox Code Playgroud)

我不明白为什么第一个生成的签名是"class C {lvalue}".如果是这样,静态成员函数需要调用C的实例,它看起来与我相矛盾.

另一方面,我定义了另一个静态成员函数而没有使用成员函数重载,它适用于没有"class C {lvalue}"签名.例如:

boostPythonTest.C.noDefaultArgMethod("string", 0, True)
Run Code Online (Sandbox Code Playgroud)

类型:function String Form:Docstring:noDefaultArgMethod((str)arg1,(int)arg2,(bool)arg3) - > int:

C++ signature :
    int noDefaultArgMethod(
Run Code Online (Sandbox Code Playgroud)

class std :: basic_string,class std …

c++ python static boost overloading

7
推荐指数
1
解决办法
1739
查看次数

Python - How to change autopct text color to be white in a pie chart?

pie(fbfrac,labels = fblabel,autopct='%1.1f%%',pctdistance=0.8,startangle=90,colors=fbcolor)
Run Code Online (Sandbox Code Playgroud)

I have the chart displaying just as I want it, with the exception that the text will stand out better inside the plot if it is white instead of black.

python matplotlib

5
推荐指数
3
解决办法
7814
查看次数

brew 在哪里安装 Python 头文件?

我正在尝试编译一个简单的“你好,世界!” 在 Cython 中。在一个文件中,我有:

print("Hello, World!")
Run Code Online (Sandbox Code Playgroud)

我跑:

cython hello_world.pyx
Run Code Online (Sandbox Code Playgroud)

获取hello_world.c文件。然后我尝试:

gcc -c hello_world.c
Run Code Online (Sandbox Code Playgroud)

这给出了错误:

fatal error: 'Python.h' file not found
Run Code Online (Sandbox Code Playgroud)

然后我试过这个

gcc -c hello_world.c -framework Python
Run Code Online (Sandbox Code Playgroud)

没用。我已更改include "Python.h"<Python/Python.h>并收到不同的错误:

fatal error: 'longintrepr.h' file not found
Run Code Online (Sandbox Code Playgroud)

无论如何,我想使用 Python3,而不是 Apple 附带的 Python,但我无法弄清楚 Python3 开发头文件的位置。

最终,我希望能够进行编译,hello_world.c以便它在 Python3 解释器中工作。

(我正在使用 brew 的 python3.5.2_1,如果有帮助的话。)

python homebrew cython python-3.x

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

当一个语句中有两个不同的错误时,Python 如何决定显示哪一个?

当我们在解释器中输入以下内容时:

10(b)
Run Code Online (Sandbox Code Playgroud)

我们得到一个未定义 b 的 NameError。但是,当我们尝试:

10(4)
Run Code Online (Sandbox Code Playgroud)

现在,我们得到了 int 不可调用的错误信息。为什么 Python 在上面的第一种情况下没有给出相同的错误,因为即使在那里, int 也是不可调用的?换句话说,在第一个片段中,我们有“int not callable”和“NameError”这两个错误。如果 Python 从左到右扫描,它首先会看到对 int (10) 执行的调用操作。所以它也应该为第一个给出“int not callable”错误。为什么没有?

我认为这可能是因为它首先评估括号内的表达式。但是,当我们尝试这样做时:

f(print("Hello"))
Run Code Online (Sandbox Code Playgroud)

现在,它说 NameError 没有定义 f。它甚至不打印“你好”。所以这表明我们对带括号的表达式求值的假设似乎不成立。

那么它究竟是如何工作的呢?

python-3.x

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