小编KcF*_*nMi的帖子

警告:'auto'类型说明符是C++ 11扩展[-Wc ++ 11-extensions]

我在Debian Jessie上使用Qt5和Clang.要试验泛型lambda,在.pro文件中有:

CONFIG += c++14
Run Code Online (Sandbox Code Playgroud)

建成之后我得到了:

warning: 'auto' type specifier is a C++11 extension [-Wc++11-extensions]
Run Code Online (Sandbox Code Playgroud)

为了摆脱这个明显的信息我做了:

QMAKE_CXXFLAGS += -Wc++11-extensions
Run Code Online (Sandbox Code Playgroud)

但我一直得到明显的信息.为什么?如何隐藏它?

c++ qt c++11 qt5 c++14

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

禁用有关 Sublime Text 上提交的 (GitGutter) 消息

Sublime Text 显示一条有关 git commit 的消息。它出现在源代码的中间,但不是源代码的一部分,这让我完全困惑。它就像一个注释,消息内容如下:

Commit author (a day ago) - Commit message
Run Code Online (Sandbox Code Playgroud)

请问,怎么去掉呢?

我很确定它来自 GitGutter 包(https://jisaacks.github.io/GitGutter/settings/),因为当我禁用该包进行查看时,它会停止出现。但找不到任何有关此功能的参考。

git plugins gutter sublimetext sublimetext3

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

vcpkg 注册表版本和 port_version

创建 vcpkg 注册表的文档中我看到

{
  "versions": [
    {
      "version": "2.6.3",
      "port-version": 0,
      "path": "$/ports/kitten/2.6.3_0"
    },
    {
      "version": "2.6.2",
      "port-version": 0,
      "path": "$/ports/kitten/2.6.2_0"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

为什么我们需要port_version,还不够version

vcpkg

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

Qt安装程序框架问题编译binarycreator

我有带有 mingw48_32 的 Qt Creator 5.2.0(MSVC 2010,32 位)。我正在尝试为我的应用程序制作安装程序,但我无法编译 binarycreator。我从官方链接下载源代码 当我运行项目时,只显示带有 .o 和没有 .exe 文件的文件。显示以下错误:

c:/qt/qt5.2.0/tools/mingw48_32/bin/../lib/gcc/i686-w64-mingw32/4.8.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -linstaller
Run Code Online (Sandbox Code Playgroud)

在那之后,还有更多错误,但我认为如果我解决这个问题,它们也会被修复。以下是以下内容:

collect2.exe: error: ld returned 1 exit status
Makefile.Release:84: recipe for target 'bin\binarycreator.exe' failed
mingw32-make[1]: *** [bin\binarycreator.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/Installer/installer-framework-installer-framework/tools/build-binarycreator-Desktop_Qt_5_2_0_MinGW_32bit-Release'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
20:30:45: The process "C:\Qt\Qt5.2.0\Tools\mingw48_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project binarycreator (kit: Desktop Qt 5.2.0 MinGW 32bit)
When executing step 'Make'
Run Code Online (Sandbox Code Playgroud)

如果any1可以帮助我,请。

installation qt frameworks qt-installer

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

是否可以在 Electron 电子快速启动 JS 应用程序中禁用放大/缩小功能?

这个问题特定于电子快速启动,所以它不是重复的。

我正在使用https://github.com/electron/electron-quick-start进行 JS 桌面应用程序的第一步,我有代码,我可以在我的 mac(hine) 上运行该应用程序。

我注意到可以放大/缩小应用程序上的文本,这是网络的常见功能。桌面应用程序并不常见。

如何禁用该行为?

javascript node.js electron

3
推荐指数
2
解决办法
4727
查看次数

在文本字符串中每两个字符放一个空格

给出以下字符串:

6e000000b0040000044250534bb4f6fd02d6dc5bc0790c2fde3166a14146009c8684a4624
Run Code Online (Sandbox Code Playgroud)

这是字节数组的表示,每两个字符代表一个字节.

我想使用Sublime Text在每个Byte之间放一个空格,例如:

6e 00 00 00 b0 04 00 00 04 42 50 
Run Code Online (Sandbox Code Playgroud)

Sublime Text会帮我解决这个问题吗?

作为奖励,我想分成行并在每个字节前添加0x.

我发现了一个类似的问题但是没有相关的Sublime Text,每两个字符多次拆分字符串.

text replace sublimetext

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

gdal使用python翻译比例并保存为jpg

我知道如何使用 gdal 翻译来缩放并通过命令行保存为 jpg:

gdal_translate image.bsq image.jpg -of JPEG -outsize 10% 10% -scale
Run Code Online (Sandbox Code Playgroud)

这会产生(我称之为漂亮的图像):

在此输入图像描述

我想通过 python 生成类似的图像,例如:

from osgeo import gdal
img_bsq  = 'image.bsq'
img_jpg  = 'image.jpg'  
gdal.Translate(img_jpg, img_bsq, format='JPEG', width=1024, height=0, scaleParams=[[500,1000,10,20]])
Run Code Online (Sandbox Code Playgroud)

我认为的问题是如何正确选择scaleParams-scale命令行上似乎会自动计算值,如下所示man gdal_translate

-scale [src_min src_max [dst_min dst_max]]:
           Rescale the input pixels values from the range src_min to src_max to the range dst_min to dst_max. If omitted the output range is 0
           to 255. If omitted the input range is automatically computed …
Run Code Online (Sandbox Code Playgroud)

python gis image gdal

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

命名空间::变量的多重定义,甚至使用 ifndef

我知道我在这里一定做错了什么。

等级.h

#ifndef RANK_H
#define RANK_H
namespace mmi {
int chunk;
void rank(int my_rank);
}
#endif
Run Code Online (Sandbox Code Playgroud)

排名.cpp

#include "rank.h"
namespace mmi {
//do something with chunk
}
Run Code Online (Sandbox Code Playgroud)

主程序

#include "rank.h"
int main() {
    mmi::chunk = 1;
}
Run Code Online (Sandbox Code Playgroud)

以及编译的输出;

g++ -g -Wall -std=gnu++11   -c -o main.o main.cpp
g++ -g -Wall -std=gnu++11   -c -o rank.o rank.cpp
mpic++ main.o rank.o  -o main
rank.o:(.bss+0x0): multiple definition of `mmi::chunk'
main.o:(.bss+0x0): first defined here
collect2: error: ld returned 1 exit status
Makefile:12: recipe for target 'main' …
Run Code Online (Sandbox Code Playgroud)

c++ namespaces c++11 ifndef

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

计时器是从另一个线程启动的吗?

QThread文档建议了两种使代码在单独的线程中运行的方法。如果我子类化 QThread 并重新实现 run(),那么我得到

QBasicTimer::start: Timers cannot be started from another thread  
Run Code Online (Sandbox Code Playgroud)

-

#include <QWidget>
#include <QThread>
#include <QBasicTimer>
#include <QDebug>
#include <QEvent>
#include <QCoreApplication>

class Worker : public QThread
{
    Q_OBJECT
    int id;
    bool m_abort = false;
    bool compute = false;
public:
    Worker() {}

protected:
    void timerEvent(QTimerEvent *event) override {
        if (event->timerId() == id) {
            compute = true;
        } else {
            QObject::timerEvent(event);
        }
    }
public slots:
    void abort() {m_abort = true;}
    void run() {
        qDebug() << QThread::currentThreadId();
        QBasicTimer …
Run Code Online (Sandbox Code Playgroud)

c++ qt multithreading qthread qtimer

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

如何在没有 webengine 的情况下构建 Qt5?

以下是在 macOS 上从源代码构建 Qt5 的结果。需要31G,其中27G来自webengine。不幸的是我没有跟踪构建时间,但它有很多小时。

我认为我的应用程序不需要网络引擎。我想如果没有它,构建会更快(而且更小)。

如何webengine从构建中删除?

$ du -h -d 1 qt-everywhere-src-5.12.7
6.7M    qt-everywhere-src-5.12.7/qtwebsockets
 30M    qt-everywhere-src-5.12.7/qtquickcontrols
 10M    qt-everywhere-src-5.12.7/qtserialbus
3.2M    qt-everywhere-src-5.12.7/qtgamepad
3.7M    qt-everywhere-src-5.12.7/qtwebview
332M    qt-everywhere-src-5.12.7/qtdeclarative
3.1M    qt-everywhere-src-5.12.7/qtmacextras
2.7G    qt-everywhere-src-5.12.7/qtbase
 20M    qt-everywhere-src-5.12.7/qtsvg
1.3M    qt-everywhere-src-5.12.7/qtandroidextras
2.6M    qt-everywhere-src-5.12.7/qtactiveqt
 17M    qt-everywhere-src-5.12.7/qtremoteobjects
3.5M    qt-everywhere-src-5.12.7/qtpurchasing
 18M    qt-everywhere-src-5.12.7/qtsensors
3.1M    qt-everywhere-src-5.12.7/qtwinextras
 32M    qt-everywhere-src-5.12.7/qtcanvas3d
 26M    qt-everywhere-src-5.12.7/qtconnectivity
4.1M    qt-everywhere-src-5.12.7/qtnetworkauth
 16M    qt-everywhere-src-5.12.7/qtdoc
4.2M    qt-everywhere-src-5.12.7/gnuwin32
2.6M    qt-everywhere-src-5.12.7/qtspeech
 47M    qt-everywhere-src-5.12.7/qtscript
 46M    qt-everywhere-src-5.12.7/qtcharts
 20M    qt-everywhere-src-5.12.7/qtgraphicaleffects
2.7M    qt-everywhere-src-5.12.7/coin
1.9M    qt-everywhere-src-5.12.7/config.tests
5.8M    qt-everywhere-src-5.12.7/qtserialport
 41M    qt-everywhere-src-5.12.7/qtvirtualkeyboard
2.7M    qt-everywhere-src-5.12.7/qtx11extras
 27G    qt-everywhere-src-5.12.7/qtwebengine
5.0M    qt-everywhere-src-5.12.7/qtwebchannel
1.9M    qt-everywhere-src-5.12.7/qtwebglplugin
 18M …
Run Code Online (Sandbox Code Playgroud)

c++ qt build qt5

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