草庐IT

static-compilation

全部标签

c++ - 错误 C1047 : Object file created with an older compiler than other objects

我有一个项目,我在Windows7上的VisualStudio2008SP1的Release模式下用C++构建,当我构建它时,我不断得到:fatalerrorC1047:Theobjectorlibraryfile'.\Release\foobar.obj'wascreatedwithanoldercompilerthanotherobjects;rebuildoldobjectsandlibraries.链接时发生错误。我已经尝试删除特定的目标文件并重建,但这并不能解决问题。我也试过吹走整个发布构建文件夹并重建,但这也没有解决它。有什么想法吗? 最佳答案

c++ - 错误 C1047 : Object file created with an older compiler than other objects

我有一个项目,我在Windows7上的VisualStudio2008SP1的Release模式下用C++构建,当我构建它时,我不断得到:fatalerrorC1047:Theobjectorlibraryfile'.\Release\foobar.obj'wascreatedwithanoldercompilerthanotherobjects;rebuildoldobjectsandlibraries.链接时发生错误。我已经尝试删除特定的目标文件并重建,但这并不能解决问题。我也试过吹走整个发布构建文件夹并重建,但这也没有解决它。有什么想法吗? 最佳答案

c++ - 为什么 "static"关键字在 C 和 C++ 中有这么多含义?

这个问题在这里已经有了答案:Whatisthepurposeofstatickeywordinarrayparameteroffunctionlike"chars[static10]"?(1个回答)关闭8年前。我们知道,关键字static有multiplemeanings在C.C99中增加了合法书写的可能性voidfoo(intarr[static50]){//...}这增加了困惑,C++有静态成员变量和函数。如果所有用途都可以以某种方式连接起来,这将不会那么麻烦,但我发现对于某些情况很难找到该链接。特别是为什么应该使用static关键字来修改可见性(链接),或者它与数组的最小元素数量

c++ - 为什么 "static"关键字在 C 和 C++ 中有这么多含义?

这个问题在这里已经有了答案:Whatisthepurposeofstatickeywordinarrayparameteroffunctionlike"chars[static10]"?(1个回答)关闭8年前。我们知道,关键字static有multiplemeanings在C.C99中增加了合法书写的可能性voidfoo(intarr[static50]){//...}这增加了困惑,C++有静态成员变量和函数。如果所有用途都可以以某种方式连接起来,这将不会那么麻烦,但我发现对于某些情况很难找到该链接。特别是为什么应该使用static关键字来修改可见性(链接),或者它与数组的最小元素数量

c++ - constexpr if 和 static_assert

P0292R1constexprif已included,在C++17的轨道上。它看起来很有用(并且可以代替SFINAE的使用),但是关于static_assert的评论格式错误,不需要诊断在false分支中让我感到害怕:Disarmingstatic_assertdeclarationsinthenon-takenbranchofaconstexprifisnotproposed.voidf(){ifconstexpr(false)static_assert(false);//ill-formed}templatevoidg(){ifconstexpr(false)static_ass

c++ - constexpr if 和 static_assert

P0292R1constexprif已included,在C++17的轨道上。它看起来很有用(并且可以代替SFINAE的使用),但是关于static_assert的评论格式错误,不需要诊断在false分支中让我感到害怕:Disarmingstatic_assertdeclarationsinthenon-takenbranchofaconstexprifisnotproposed.voidf(){ifconstexpr(false)static_assert(false);//ill-formed}templatevoidg(){ifconstexpr(false)static_ass

c++ - CMake:何时使用 add_definitions 而不是 set_target_properties(目标 PROPERTIES COMPILE_DEFINITIONS 定义)

在CMake文档中,我们可以阅读:add_definitionsAddsflagstothecompilercommandlineforsourcesinthecurrentdirectoryandbelow.COMPILE_DEFINITIONSpropertyondirectoriesCOMPILE_DEFINITIONS:Preprocessordefinitionsforcompilingadirectory'ssources.COMPILE_DEFINITIONSpropertyontargetsCOMPILE_DEFINITIONS:Preprocessordefiniti

c++ - CMake:何时使用 add_definitions 而不是 set_target_properties(目标 PROPERTIES COMPILE_DEFINITIONS 定义)

在CMake文档中,我们可以阅读:add_definitionsAddsflagstothecompilercommandlineforsourcesinthecurrentdirectoryandbelow.COMPILE_DEFINITIONSpropertyondirectoriesCOMPILE_DEFINITIONS:Preprocessordefinitionsforcompilingadirectory'ssources.COMPILE_DEFINITIONSpropertyontargetsCOMPILE_DEFINITIONS:Preprocessordefiniti

c++ - 将默认赋值运算符声明为 constexpr : which compiler is right?

考虑structA1{constexprA1&operator=(constA1&)=default;~A1(){}};structA2{constexprA2&operator=(constA2&)=default;~A2()=default;};structA3{~A3()=default;constexprA3&operator=(constA3&)=default;};GCC和MSVC接受所有三个结构。Clang拒绝A1和A2(但接受A3),并带有以下错误消息::2:5:error:defaulteddefinitionofcopyassignmentoperatorisnot

c++ - 将默认赋值运算符声明为 constexpr : which compiler is right?

考虑structA1{constexprA1&operator=(constA1&)=default;~A1(){}};structA2{constexprA2&operator=(constA2&)=default;~A2()=default;};structA3{~A3()=default;constexprA3&operator=(constA3&)=default;};GCC和MSVC接受所有三个结构。Clang拒绝A1和A2(但接受A3),并带有以下错误消息::2:5:error:defaulteddefinitionofcopyassignmentoperatorisnot