我正在使用openssl,在构建期间我收到了很多关于缺少libeay.pdb的警告.有人可以建议如何添加它吗?
build.cmd看起来像这样(我认为重要的部分):
...
perl util\mk1mf.pl debug dll no-asm VC-WIN64A >ms\ntdll64.dbg.mak
perl util\mkdef.pl 32 libeay > ms\libeay32.def
nmake -f ms/nt64.dbg.mak
Run Code Online (Sandbox Code Playgroud)
我读了INSTALL.W32,上面写着"如果你使用平台debug-VC-WIN32而不是VC-WIN32,那么将编译调试符号." 我试图用debug-WIN64A替换VC-WIN64A(与32相同),并且构建给了我一个错误
Unknown option --debug-VC-WIN64A
Run Code Online (Sandbox Code Playgroud)
谢谢.
编辑:当我在mak之后添加/ DEBUG
再次编辑时它起作用:/ DEBUG不是必需的,命令中的调试字完成了工作.
如何使用Visual Studio构建它?
我正在尝试使用python,主要是对其他人的代码进行故障排除.我正在尝试运行程序," path\folderA\program.py".
我正在运行该程序 path\folderA
我收到一个错误:
ImportError: No module named fff.ggg.ppp
Run Code Online (Sandbox Code Playgroud)
program.py包含一个导入:
from fff.ggg.ppp import mmm
Run Code Online (Sandbox Code Playgroud)
在文件夹"path\folderB"中有:" path\folderB\fff\__init__.py"" path\folderB\fff\ggg"
文件夹ggg还包含 __init__.py,以及程序ppp.py
从阅读其他帖子,如Python错误"ImportError:没有模块命名"我明白,__init__.py让一个文件夹成为一个"包",使得从它进口 - 但它不起作用,因为我收到一个错误.
这一直适用于使用这些项目的其他人,所以我的设置有问题.
我读了一些关于必须在sys.path中的目录的内容.这是否意味着我必须将它们添加到环境变量路径中?这意味着要向PATH添加很多目录,所以它不可能.
所以我也发现了以下内容:
import sys
sys.path.append( <path to FolderB> )
Run Code Online (Sandbox Code Playgroud)
但这意味着改变代码(对于其他人来说并不是必需的)并且硬编码到我本地机器上的路径 - 我不应该这样做,对吧?
我无法想象它 - 显然我不应该更改代码并硬编码导入模块的物理路径 - 那么来自folderA的程序怎么能知道在folderB中查找导入?
__init__.py工作的魔力如何?
typedef boost::shared_ptr<SomeData> data_ptr;
data_ptr cached_ptr; // class member
bool someWork(data_ptr& passed_ptr)
{
// must copy passed_ptr = cached_ptr under some conditions
// without pointing at the same memory
// I saw somewhere that I should do
// passed_ptr.reset(new SomeData(???))
// I don't have a "reset" on passed_ptr
}
Run Code Online (Sandbox Code Playgroud)
我查看了文档;
复制和转换构造函数
shared_ptr(shared_ptr const & r); // never throws
template<class Y> shared_ptr(shared_ptr<Y> const & r); // never throws
Requires: Y* should be convertible to T*.
Effects: If r is empty, constructs an …Run Code Online (Sandbox Code Playgroud) 我正在尝试在x64中构建GDAL(1.9.2).
在说明中,我看到:
# Uncomment the following if you are building for 64-bit windows
# (x64). You'll need to have PATH, INCLUDE and LIB set up for 64-bit
# compiles.
!IF "$(PLATFORM)" == "x64"
WIN64=YES
!ENDIF
Run Code Online (Sandbox Code Playgroud)
然后,降低,
# Under win64, symbols for function names lack the underscore prefix
# present on win32. Also the STDCALL calling convention is not used.
!IFDEF WIN64
!UNDEF STDCALL
!ELSE
SYM_PREFIX=_
!ENDIF
Run Code Online (Sandbox Code Playgroud)
找不到特定于x64的PATH,INCLUDE和LIB,或者我应该做的任何其他事情......
我可以在Win32中构建.
在x64中,我收到链接器错误:
LINK : error LNK2001: unresolved external symbol _OGRFeatureStylePuller
LINK : error …Run Code Online (Sandbox Code Playgroud) 我正在使用的程序是读取一些位图,并期望32FC1图像.
我正在尝试创建这些图像
cv::Mat M1(255, 255, CV_32FC1, cv::Scalar(0,0,0));
cv::imwrite( "my_bitmap.bmp", M1 );
Run Code Online (Sandbox Code Playgroud)
但是当我检查深度时 - 它总是CV_8U
如何创建文件以便它们包含正确的信息?
更新:如果我使用不同的文件扩展名也没有区别 - 例如tif或png
我正在阅读它 - 使用已经实现的代码 - cvLoadImage.
我正在尝试创建现有代码(检查图像类型)可以使用的文件.
我无法转换现有代码中的文件.现有代码不会尝试读取随机图像类型并将其转换为所需类型,但会检查文件是否为所需类型.
我发现了 - 谢谢你的答案 - cv :: imwrite只写整数类型的图像.
有没有另一种方法 - 使用OpenCV或其他东西 - 来编写图像,以便我最终得到CV_32F类型?
再次更新: 读取图像的代码...如果进入cv :: Mat:
cv::Mat x = cv::imread(x_files, CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_ANYCOLOR);
Run Code Online (Sandbox Code Playgroud)
现有代码:
IplImage *I = cvLoadImage(x_files.c_str(), CV_LOAD_IMAGE_ANYDEPTH|CV_LOAD_IMAGE_ANYCOLOR);
Run Code Online (Sandbox Code Playgroud) 我正在运行启动流程的Qt应用程序(Qt助手)
当应用程序在OSX上运行时,进程窗口显示在调用者窗口后面...
我怎么能把它带到前面?
Qt文档中的代码:
QProcess *process = new QProcess();
QStringList args;
args << QLatin1String("-collectionFile")
<< QLatin1String("mycollection.qhc");
//<< QLatin1String("-enableRemoteControl"); // can't use this, help freezes... but still starts in background! ... this is apparently a bug in Qt solved in Qt 5.4 (see Note) which I cannot use, but not relevant for current problem
process->start(QLatin1String("Assistant.app"), args);
if (!process->waitForStarted())
return;
Run Code Online (Sandbox Code Playgroud)

关于不使用"-enableRemoteControl"的注意事项 - 请参阅问题
标记为重复/投票的闭合点指向以分离方式启动进程的示例.尝试它并没有解决问题 - 此外,帮助必须是应用程序的子进程.
根据评论/发布的答案更新:
试
QString app = "path/to/Assistant"; // since I use the copy from inside …Run Code Online (Sandbox Code Playgroud) 我有一个由主窗口调用的UI窗口.我希望它是非模态的,但保持在父级之上,如果父级被最小化,则用它最小化.
如果用户想要在两者中进行更改,他应该能够,并且除非用户关闭它,否则不会关闭孩子.孩子总是会保持在父母之上 - 但不会在其他任何事情之上.
m_child->show();
m_child->activateWindow();
Run Code Online (Sandbox Code Playgroud)
上面将子项放在父项的顶部,它允许在子项启动时对父项进行操作...但如果父项失去焦点,则子项隐藏在父项后面.
m_child->show();
m_child->activateWindow();
m_child->raise();
Run Code Online (Sandbox Code Playgroud)
没变.
运用
Qt::WindowFlags flags = m_child->windowFlags();
m_child->setWindowFlags(flags | Qt::CustomizeWindowHint | Qt::WindowStaysOnTopHint);
m_child->show();
m_child->activateWindow();
Run Code Online (Sandbox Code Playgroud)
孩子在我的头顶上,正如我想要的那样,我可以在孩子仍然在顶部显示时对父母工作......但是尽量减少父母也不会最小化孩子,并且孩子会在所有窗户上停留(它应该只留在父母之上)
如何制作"工具箱样式"效果 - 在父项处于活动状态时将子项置于父项之上,但在父项最小化时最小化子项?
我还尝试了所有的窗口标志,但它们允许孩子在失去焦点时隐藏起来.
1)如何将文本QGraphicsTextItem换成适合固定矩形的文本,宽度和高度?
现在我正在尝试创建一个文本,获取它的边界矩形,并调整它以适应盒子 - 但我不能得到包装.
class TTT: public QGraphicsTextItem {
TTT() {
{
setPlainText("abcd");
qreal x = m_itemSize.width()/boundingRect().width();
qreal y = m_itemSize.height()/boundingRect().height();
scale(x, y);
}
void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget) {
// experiment with clip regions
// text gets covered by hole in clip
QRegion r0(boundingRect().toRect());
QRegion r1(QRect(5, 5, 10, 10), QRegion::Ellipse);
QRegion r2 = r0.subtracted(r1);
painter->setClipRegion(r2);
painter->setBrush(Qt::yellow);
painter->drawRect(boundingRect());
QGraphicsTextItem::paint(painter, option, widget);
}
}
Run Code Online (Sandbox Code Playgroud)
是什么让包装发生,怎么才能触发呢?
现在,当我一直打字时,该框会自动扩展.
2)是否可以将文本包装在QGraphicsItem/ QGraphicTextItem子类中不是矩形的形状?

(上图中的某些内容)
我试图使用clipRegion,请参阅上面的代码,但我想这不是正确的方法,剪切剪切文本但没有包装.
也许它会...如果我能弄清楚如何首先包装文本? …
我的LineItem继承QGraphicsLineItem可以改变它的笔宽.
我创建了一个boundingRect使用QGraphicsLineItem::boundingRect调整的垫,根据笔宽和箭头计算.有用.
void LineItem::calculateStuff() // called on any change including pen width
{
qreal padLeft, padRight, padT;
padLeft = 0.5 * m_pen.width(); // if no arrows
padT = padLeft;
padRight = padLeft;
m_boundingRect = QGraphicsLineItem::boundingRect().adjusted(-padLeft, -padT, padRight, padT);
update();
}
QRectF LineItem::boundingRect() const
{
return m_boundingRect;
}
QPainterPath LineItem::shape() const
{
QPainterPath p;
p.addRect(m_boundingRect);
return p;
}
Run Code Online (Sandbox Code Playgroud)
我得到的只有一件神器:
尽管它们很漂亮(严肃地说我认为它们是"功能:-)) - 我试图消除它们.我试图记住以前的边界矩形,并用前一个边界矩形更新项目 - 我认为这是什么选项是为了 - 但它不起作用.
QRectF oldRect = selectedItem->boundingRect();
item->setItemPenWidth(p); …Run Code Online (Sandbox Code Playgroud) 我想在TeamCity中使用JavaScript的单元测试.
我正在使用QUnit,我已经看到了一些建议使用phantomjs和QUnitTeamCityDriver的地方.我只是无法让它工作......
我没有很多这方面的经验,似乎甚至无法让phantomjs在命令行中运行单元测试.
我真的从QUnitTeamCityDriver:simple_test.html复制了这个例子
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>QUnit Example</title>
<link rel="stylesheet" href="test_tools/qunit-1.10.0.css">
<script type="text/javascript" src="resources/jquery-1.8.1.js"></script>
<script type="text/javascript" src="test_tools/qunit-1.10.0.js"></script>
<script type="text/javascript" src="qunit_teamcity_driver/QUnitTeamCityDriver.js"></script>
<script type="text/javascript" src="tests.js"></script>
</head>
<body>
<div id="qunit"></div>
<h1 id="qunit-header">QUnit example</h1>
<h2 id="qunit-banner"></h2>
<div id="qunit-testrunner-toolbar"></div>
<h2 id="qunit-userAgent"></h2>
<ol id="qunit-tests"></ol>
<div id="qunit-fixture">test markup, will be hidden</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
如果我尝试使用simple_test.html,tests.js有一些简单的测试可以工作与否.
当然,html中的其他引用文件位于相应的文件夹中.
phantomjs.exe,tests.js和simple_test.html位于我调用的目录的根目录中.
TeamCity构建的方向是:
Add a "Command Line" Build Step to your build in TeamCity which executes Tests.htm via PhantomJS
Command executable: C:\PhamtomJS\phantomjs.exe
Command parameters: \Scripts\QUnitTeamCityDriver.phantom.js Tests.htm
Run Code Online (Sandbox Code Playgroud)
(这不起作用,所以我想在插入TeamCity内的命令行之前测试实际的命令行)
我试过的一些事情:
phantomjs.exe …Run Code Online (Sandbox Code Playgroud)