草庐IT

gnu-make

全部标签

c++ - Qt 需要 C++11 支持"make error

我尝试按照README.md中的说明从源代码编译最新的平铺。我的工作环境:平铺源代码:tiled-0.16.1Mac操作系统:10.11.1Xcode:7.1Q制作:3.0Qt:5.7.0苹果LLVM:7.0.0但是make失败并出现以下错误:Infileincludedfrompythonplugin.cpp:21:Infileincludedfrom./pythonplugin.h:30:Infileincludedfrom../../libtiled/logginginterface.h:33:Infileincludedfrom../../libtiled/tiled_glob

c++ - std::make_unique(以及 emplace、emplace_back)对 initializer_list 参数的笨拙推导

假设我有这个结构:structposition{intx,y;};和另一个将this作为构造函数参数的类:classpositioned{public:positioned(positionp):pos(p){}private:positionpos;};我怎样才能得到简单的autobla=std::make_unique({1,2});上类?目前,编译器试图通过initializer_list匹配并调用make_unique的数组变体,这很愚蠢,因为positioned只有一个构造函数。emplace出现同样的问题和emplace_back功能。几乎所有将其可变模板参数转发给类的构造

c++ - 使用 make_shared 和 make_unique 时需要检查 nullptr 吗?

如果我使用make_shared或make_unique创建指针,我是否必须检查它是否为nullptr,例如:std::unique_ptrp=std::make_unique();if(p==nullptr){........}如果您真的内存不足,std::make_unique将通过预期。所以你永远不会从std::make_unique得到空指针。这是正确的吗?所以在执行make_shared和make_unique时不需要检查nullptr吗? 最佳答案 来自std::make_unique上的cppreference(类似于

c++ - 为什么使用 clang -std=gnu++11 时此 C++ 代码会编译?

使用clang-std=gnu++11-ctest.cpp编译:voidtest(){[[randomtexthere]]if(0){}}但这会产生错误main.cpp:3:1:error:expectedstatement:voidtest(){[[randomtexthere]]}如果我使用clang-std=gnu++11-S-emit-llvmmain.cpp编译并查看LLVM代码,它看起来像[[...]]行无效:definevoid@_Z5testv()nounwinduwtablessp{retvoid}有什么想法吗?错误或某些C++11语法或GNU扩展语法?我正在使用Xc

c++ - 更改时 Make 不会重建 header

我有一个项目,我定期修改header,当我这样做时,忘记了makeclean然后make,我得到了各种奇怪的行为。我目前正在使用QtCreator作为我的IDE,但我已经在独立于Qt的项目中看到过这种情况。我的项目变得相当大,每次更改header时都必须重建,这变得效率低下。有什么想法吗?供将来引用:如果使用QMake系统:DEPENDPATH+=.\HeaderLocation1/\HeaderLocation2/\HeaderLocation2/HeaderSubLocation1/\HeaderLocation2/HeaderSubLocation2/\HeaderLocatio

c++ - 使用 MinGW 时 NetBeans Make 命令

我正在尝试使用NetBean来编写C++程序,我已经遵循了每个在这里找到的命令:https://netbeans.org/community/releases/68/cpp-setup-instructions.html#compilers_windows但是,我在使用netbeans中的make命令选项时遇到了问题。我已经将基本目录设置为M:\c++\bin,我在其中安装了MinGW,并将make命令设置为M:\MinSYS\bin\make.exe,但是在尝试构建一个简单程序时,netbeans会生成以下错误:"/M/c++/MinSYS/bin/make.exe"-fnbproj

c++ - GNU ld 找不到存在的库

我在这里玩弄的包是相当未知的,但问题是相当普遍的。基本上,我正在尝试使用C++扩展编译Python模块(称为rql)。该扩展使用名为gecode的外部框架,其中包含多个库。我编译了gecode并安装在本地。现在,让输出说明一切:red@devel:~/build/rql-0.23.3$echo$LD_LIBRARY_PATH/home/red/usr/libred@devel:~/build/rql-0.23.3$ls$LD_LIBRARY_PATH|greplibgecodeintlibgecodeint.solibgecodeint.so.22libgecodeint.so.22.

c++ - 是否可以强制 `std::make_shared` 使用类的新运算符?

是否可以强制std::make_shared使用类的new运算符?这涉及另一个SOquestion.根据那个问题,std::make_shared使用自定义分配器:Fromthestandard(§20.7.2.2.6shared_ptrcreation):Effects:AllocatesmemorysuitableforanobjectoftypeTandconstructsanobjectinthatmemoryviatheplacementnewexpression::new(pv)T(std::forward(args)...).因此,我认为我可以使用自定义放置新运算符,但这

c++ - 带有大括号初始化的 make_unique

https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique写道std::make_unique可以实现为templatestd::unique_ptrmake_unique(Args&&...args){returnstd::unique_ptr(newT(std::forward(args)...));}这不适用于没有构造函数的普通结构。这些可以用大括号初始化,但没有非默认构造函数。示例:#includestructpoint{intx,z;};intmain(){std::make_unique(1,2);}Com

c++ - 如何在 GNU Autotools 项目中包含 Boost?

我的项目使用GNU自动工具编译(aclocal&&autoconf&&./configure&&make)。我想使用Boost,并且我希望其他人也能够编译它。我应该将Boost放在我的项目目录中,还是依赖于系统的Boost?我应该如何告诉autotools使用Boost?我用谷歌搜索并发现许多声称可以执行此操作的m4文件-但我应该将这些m4文件放在哪里?我可以将一个存储在我的/usr/share/aclocal目录中,但这对其他想要使用./configure&&make编译项目的人没有帮助。 最佳答案 TheArchive有AX_B