小编Nic*_*ick的帖子

将protobuf库与代码链接(Google协议缓冲区)

我在尝试编译测试代码时遇到链接错误.我在Windows 7上使用cygwin.像./configure,make,make test和make install这样的初始步骤很顺利

我也能用protoc命令生成.pb.cc和.pb.h.

但是当我尝试编译我的测试代码时,会出现许多链接错误.我确定这些错误是因为它无法链接到库.

Cygwin在/ usr/local/lib中有protobuf静态库和链接库.包含文件存在于/ usr/local/include中

我尝试使用-lprotobuf,但它返回错误,说找不到-lprotobuf

linker protocol-buffers

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

uint8_t不需要两位数输入

这是我的测试代码

#include<iostream>
using namespace std;
int main() 
{
    uint8_t a;
    while(1)
    {
        cin>>a;
        if(a == 0) break;
        cout<<"Input is "<<a<<endl;
    }
}  
Run Code Online (Sandbox Code Playgroud)

当我执行(使用我的输入)时,这就是我得到的

1
Input is 1
2
Input is 2
12
Input is 1
Input is 2
0
Input is 0
3  
Input is 3
Run Code Online (Sandbox Code Playgroud)

问题1:它将输入12作为两个独立的输入

问题2:条件是否= = 0不起作用

可能是什么问题?

c++ uint

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

如何使用Google Cardboard SDK构建光球图像的立体查看器

Cardboard Demo应用程序有一个很好的功能,我们可以看到现有的photospheres.我想构建一个类似的应用程序

我已经浏览了谷歌提供的Cardboard SDK.但还没有找到一个简单的方法来做到这一点.我要从头开始构建,采取所有的感官输入和相应的更新框架,这是一个非常痛苦的过程.

我想知道

  1. 如果有一个简单的方法来做到这一点
  2. 如果有可用的Google Cardboard应用程序源代码,我可以继续使用

android stereoscopy photosphere google-cardboard

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

如何在客观c中平滑地绘制自由手线?

我使用uigraphics cgcontext在触摸上绘制线条...但我的线条不平滑我的意思是边缘不光滑所以任何人都可以建议我如何画出流畅的线条.这里是我用来画线的代码:

/* touchesBegan */
UITouch *touch = [touches anyObject];
lastPoint = [touch locationInView:imagevw];

/* touchesMoved */

CGFloat width = [mySlider value];
UIGraphicsBeginImageContext(imagevw.frame.size);
[imagevw.image drawInRect:CGRectMake(0, 0, imagevw.frame.size.width,imagevw.frame.size.height)];
CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound);
CGContextSetLineWidth(UIGraphicsGetCurrentContext(), width);
UITouch *touch = [touches anyObject];
mouseSwiped = YES;  
    CGPoint currentPoint = [touch locationInView:imagevw];
    CGContextBeginPath(UIGraphicsGetCurrentContext());
    CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
    CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), currentPoint.x, currentPoint.y);
    CGContextStrokePath(UIGraphicsGetCurrentContext());
    imagevw.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
lastPoint = currentPoint;





/*  touchesEnded */
/* same here */ 
CGContextMoveToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);
        CGContextAddLineToPoint(UIGraphicsGetCurrentContext(), lastPoint.x, lastPoint.y);`
Run Code Online (Sandbox Code Playgroud)

这是我的代码,我可以画线自由,但它不是那么平滑显示像素我的意思是边缘不平滑

objective-c

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