小编And*_*ndt的帖子

在Ubuntu 14.04上构建linuxbrew(homebrew)独立版本

主要问题

我正在尝试在Ubuntu 14.04.3 LTS上构建linuxbrew独立安装,但原始链接中的脚本目前已损坏.我理想的答案是一个可以一次性正确设置的脚本.我已经改进了脚本以减少打嗝运行.

目前修复脚本的进展

我不能让过去一个crti.o通过linuxbrew作为独立设置的一部分编译GCC时错误.但是,我找到了解释问题的一些资源:

我搜索了文件,它就在那里!

find -name crti.o
./.linuxbrew/lib/crti.o
./.linuxbrew/Cellar/glibc/2.19/lib/crti.o
Run Code Online (Sandbox Code Playgroud)

我目前正在处理以下编译器错误crtn.o:

/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find crti.o: No such file or directory
/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find -lc
/home/hbr/.linuxbrew/Cellar/binutils/2.25.1/x86_64-unknown-linux-gnu/bin/ld: cannot find crtn.o: No such file or directory
collect2: error: ld returned 1 exit status
make[3]: *** [libgcc_s.so] Error 1
make[3]: Leaving directory `/tmp/gcc20150929-3726-hif3of/gcc-5.2.0/build/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/tmp/gcc20150929-3726-hif3of/gcc-5.2.0/build'
make[1]: *** [stage1-bubble] Error 2
make[1]: …
Run Code Online (Sandbox Code Playgroud)

installation ubuntu homebrew linuxbrew

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

边界框内的numpy过滤点

我有[(x1,y1),(x2,y2),...,(xn,yn)]ndy 中的2d点列表,如何获得角点指定的边界框内的点列表((bx1,by1),(bx2,by2))

如果这是C++,我将使用boost几何中OGC"within"规范来过滤列表.

现在我只是处理一个NxN 2d numpy数组的索引列表,所以我希望这应该是1-2行代码与numpy.

python numpy bounding-box coordinates

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

球与球碰撞 - 碰撞时获得显着的速度

我在Objective-C中实现了" Ball to Ball Collision - Detection and Handling " 问题的代码.然而,每当球以一定角度碰撞时,它们的速度会急剧增加.所有的矢量数学都是使用cocos2d-iphone完成的,标题为CGPointExtension.h.这种不希望的加速的原因是什么?

以下是速度提高的示例:

输入:
质量== 12.56637
velocity.x == 1.73199439
velocity.y == -10.5695238

ball.mass == 12.56637
ball.velocity.x == 6.04341078
ball.velocity.y == 14.2686739

输出:
质量== 12.56637
velocity.x == 110.004326
velocity.y == -10.5695238

ball.mass == 12.56637
ball.velocity.x == -102.22892
ball.velocity.y == -72.4030228

#import "CGPointExtension.h"
#define RESTITUTION_CONSTANT (0.75) //elasticity of the system

- (void) resolveCollision:(Ball*) ball
{
    // get the mtd (minimum translation distance)
    CGPoint delta = ccpSub(position, ball.position);
    float d = ccpLength(delta); …
Run Code Online (Sandbox Code Playgroud)

graphics physics objective-c collision-detection

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

使用Visual C++和MFC错误ping声音

MFC中是否有一个基本的函数调用只是播放输入错误ping?

我正在寻找类似于AfxMessageBox()调用的东西,它只是播放在发生错误时经常听到的ping.

c++ audio mfc visual-c++

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

container.erase(first,last)其中first == last在STL容器中

当在STL中第一个== last时,是否有针对container.erase(first,last)的定义行为,还是未定义?

例:

std::vector<int> v(1,1);
v.erase(v.begin(),v.begin());
std::cout << v.size(); // 1 or 0?
Run Code Online (Sandbox Code Playgroud)

如果有一个标准库规范文档有这些信息,我将不胜感激.

c++ stl

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

将boost :: mpl :: list应用于类型的模板参数

我有一个类需要一个boost :: variant包含各种类型的共享指针,如下所示:

template <typename ToySharedPtrVariant, typename ColorSharedPtrVariant>
class ToyPicker {
   typedef std::pair<
     ToySharedPtrVariant, 
     ColorSharedPtrVariant 
   > toyAndColorPair;
   typedef std::map<
     std::string,
     std::vector< 
       toyAndColoPair 
     > 
   > stringToToyColorPairMap;

   // ... methods that use the defined types...
}
Run Code Online (Sandbox Code Playgroud)

该类目前需要以下表单的模板参数进行编译:

ToyPicker<
           boost::variant<
             boost::shared_ptr<ToyModel> 
           >,
           boost::variant<
             boost::shared_ptr<BlueToy>,
             boost::shared_ptr<RedToy>,
             boost::shared_ptr<GreenToy> 
           > 
         > toyPicker;
Run Code Online (Sandbox Code Playgroud)

如何使用mpl列表以便我可以为用户提供以下更简单的定义,然后将其转换为上面类实现中的示例格式?

ToyPicker<
       boost::mpl::list<
         ToyModel
       >,
       boost::mpl::list<
         BlueToy,
         RedToy,
         GreenToy 
       > 
     > toyPicker;
Run Code Online (Sandbox Code Playgroud)

c++ boost boost-variant boost-mpl

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