小编Max*_*rai的帖子

Linux中的Google protobuf

我正在使用protobuf和Linux.它在哪里是编译器protoc.我已经从主站点下载了包,成功编译并安装了它,但我找不到protoc来构建我自己的格式文件.它在哪里?

UPD 这是我建立protobuf的文件夹:

aclocal.m4        depcomp                       Makefile.in
autogen.sh        editors                       missing
CHANGES.txt       examples                      protobuf-lite.pc
config.guess      generate_descriptor_proto.sh  protobuf-lite.pc.in
config.h          gtest                         protobuf.pc
config.h.in       install-sh                    protobuf.pc.in
config.log        INSTALL.txt                   python
config.status     java                          README.txt
config.sub        libtool                       src
configure         ltmain.sh                     stamp-h1
configure.ac      m4                            vsprojects
CONTRIBUTORS.txt  Makefile
COPYING.txt       Makefile.am
Run Code Online (Sandbox Code Playgroud)

我不需要二进制文件.

c++ protocol-buffers

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

从现有目标文件创建共享库

我的IDE中有一个项目.我需要创建一个共享库来扩展.我不想使用共享库设置制作此项目的副本.有没有办法使用我现有项目中的目标文件(.o)构建共享库?据我了解,我可以为此编写一个makefile.

c++ makefile shared-libraries

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

通过std队列迭代

我正在尝试使用BOOST_FOREACH迭代std :: queue.但是那个类中没有迭代器导致我有一个错误:

std::queue<std::string> someList;
BOOST_FOREACH(std::string temp, someList)
{
   std::cout << temp;
}

>no matching function for call to begin(...)
>no type named ‘iterator’ in ‘class std::queue<std::basic_string<char> >’
Run Code Online (Sandbox Code Playgroud)

我需要的结构如下:第一个到来,第一个消失.

c++ queue foreach iterator

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

提升任何用途

如何从boost中将我自己的类对象插入到ptr_map中.对象是模板化的,所以我不能在地图中使用一些静态类型名称.所以我做了:

ptr_map<string, any> someMap;
Run Code Online (Sandbox Code Playgroud)

我的类继承了boost :: noncopyable.

someMap.insert("Test", new MyClass<SomeTemplate>());
Run Code Online (Sandbox Code Playgroud)

错误是:错误:no matching function for call to ‘boost::ptr_map.


UPD:我更喜欢做一些包装,不要使用boost :: any.所以:

class IWrapper { };
class MyClass : public IWrapper { };

ptr_map<string, IWrapper> someMap;
someMap.insert("Test", new MyClass<SomeTemplate>());
Run Code Online (Sandbox Code Playgroud)

为什么它不起作用(同样的错误)?我可以将继承的类传递给父接口.怎么了?

c++ boost insert map boost-any

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

Firebug和邮政请求

我必须使用网站进行一些自动化工作.有一个表格,我必须得到它的后请求.问题是firebug由于重定向到另一个页面而清除了有关请求的信息,因此我没有时间保存发布数据信息.有没有办法"冻结"它?

post firebug

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

图像合成

我有一些音乐乐队的专辑标题.我想用一些将围绕图像角落的面具绘制它.所以,我在gimp中准备了这样的面具:

在此输入图像描述

我正在使用白色面具,但在白色背景下它是隐形的.所以,这是渲染的代码:

# Draw album image
img = cairo.ImageSurface.create_from_png('images/album.png')
ctx.set_source_surface(img, posX, posY)
ctx.paint()

# Draw mask
ctx.set_operator(cairo.OPERATOR_DEST_IN)
img = cairo.ImageSurface.create_from_png('images/mask.png')
ctx.set_source_surface(img, posX, posY)
ctx.paint()
Run Code Online (Sandbox Code Playgroud)

如你所见,我已经习惯了OPERATOR_DEST_IN.我在此页面上找到的快速示例.

但是,当我在cairo中设置合成运算符时,我的程序中的一切都消失了:(.当我评论该行时,一切都没问题,但是掩码超出了我的图像.正确的方法是什么?

ps我正在使用python2,cairo库


当我删除合成操作符时,我看到(不要忘记真正的蒙版是白色的,在这种情况下专辑图像是暗的):

在此输入图像描述

python image composite cairo

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

Qt和C++ - 对槽的未定义引用

我在Qt中有一个插槽的构建错误.我有一个有公共插槽的课程:

void doSomething();
Run Code Online (Sandbox Code Playgroud)

在这个类的构造函数中我做:

this->connect( ui->textFrom, SIGNAL(returnPressed()),
               this, SLOT(doSomething()) );
Run Code Online (Sandbox Code Playgroud)

我有QLineEdit - textFrom对象.构建错误是

../moc_mainwindow.cpp:66: undefined reference to `MainWindow::doSomething()'
Run Code Online (Sandbox Code Playgroud)

:-1:错误:collect2:ld返回1退出状态

请帮帮我 (:

c++ qt signals-slots undefined-reference

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

在地图存储中映射

如何在javascript中将地图存储在地图中?

var data = {};
data['key'] = {'val1', 'val2'};
Run Code Online (Sandbox Code Playgroud)

我收到有关错误ID的错误.

javascript map

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

在c ++中处理va_args

我有一个功能A(...)B(...).现在,我要打电话BA,任何方法来传递...A进入B?伪代码:

void A(...)
{
   // Some operators
   B(...); // Instead of ... I need to pass A's args
}
Run Code Online (Sandbox Code Playgroud)

ps我知道这可以使用宏完成,但功能如何.

c++ arguments function

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

Boost变种失败了

我有这样的代码:

boost::variant<b2DistanceJointDef, b2FrictionJointDef,
       b2GearJointDef, b2MouseJointDef, b2PrismaticJointDef, b2PulleyJointDef,
       b2RevoluteJointDef, b2RopeJointDef, b2WeldJointDef, b2WheelJointDef> prmJointDef;

b2DistanceJointDef &prmDistaceJointDef = boost::get<b2DistanceJointDef>(prmJointDef);
Run Code Online (Sandbox Code Playgroud)

错误是:

source\Scene\Components\JointComponent.cpp:51:96: error: no matching function for call to 'get(boost::variant<b2DistanceJointDef, b2FrictionJointDef, b2GearJointDef, b2MouseJointDef, b2PrismaticJointDef, b2PulleyJointDef, b2RevoluteJointDef, b2RopeJointDef, b2WeldJointDef, b2WheelJointDef>&)'
\source\Scene\Components\JointComponent.cpp:51:96: note: candidates are:
boost/optional/optional.hpp:626:30: note: template<class T> typename boost::optional::reference_const_type boost::get(const boost::optional<T>&)
boost/optional/optional.hpp:634:24: note: template<class T> typename boost::optional::reference_type boost::get(boost::optional<T>&)
boost/optional/optional.hpp:644:30: note: template<class T> typename boost::optional::pointer_const_type boost::get(const boost::optional<T>*)
boost/optional/optional.hpp:652:24: note: template<class T> typename boost::optional::pointer_type boost::get(boost::optional<T>*)
Run Code Online (Sandbox Code Playgroud)

这里有什么不对?

c++ boost variant

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