【CMake报错】报错:Flow control statements are not properly nested.

简介: 【CMake报错】报错:Flow control statements are not properly nested.


👉博__主👈:米码收割机

👉技__能👈:C++/Python语言

👉公众号👈:测试开发自动化【获取源码+商业合作】

👉荣__誉👈:阿里云博客专家博主、51CTO技术博主

👉专__注👈:专注主流机器人、人工智能等相关领域的开发、测试技术。



1. 报错:Flow control statements are not properly nested.

1)报错内容

CMake Error at CMakeLists.txt:70 (else):

Flow control statements are not properly nested.

– Configuring incomplete, errors occurred!

2)解决方案

此错误是由于 CMake 的流控制语句(如 ifelseelseifendif)没有正确嵌套导致的。

要解决这个问题,你需要确保每个 if 语句都有相应的 endif 语句,并确保所有的 elseelseif 语句都出现在 ifendif 之间,且顺序正确。

正确的使用方法:

if(CONDITION1)
  # Do something
elseif(CONDITION2)
  # Do something else
else()
  # Do yet another thing
endif()

错误的使用方法:

if(CONDITION1)
  # Do something
else()
  # Do something else
endif()
else()
  # This else doesn't have a matching if
endif()

为了解决你的问题,请检查 CMakeLists.txt 文件,确保所有的流控制语句都正确嵌套。



目录
打赏
0
0
0
0
35
分享
相关文章
【CMake报错】报错:Flow control statements are not properly nested.
【CMake报错】报错:Flow control statements are not properly nested.
122 0
|
9月前
|
You may wish to exclude one of them to ensure predictable runtime behavior
You may wish to exclude one of them to ensure predictable runtime behavior
68 1
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
解决Xcode报错Stored properties cannot be marked unavailable with ‘@available‘
69 0
Error loading saved preferences: ~/.vuerc may be corrupted or have syntax errors. Please fix/delete
Error loading saved preferences: ~/.vuerc may be corrupted or have syntax errors. Please fix/delete
sql injection violation, syntax error: syntax error, error in :‘**‘expect IDENTIFIER, actual IDENTIF
sql injection violation, syntax error: syntax error, error in :‘**‘expect IDENTIFIER, actual IDENTIF
252 0
|
10月前
|
Xcode 10.2.1 Error:Multiple commands produce问题及解决方案
Xcode 10.2.1 Error:Multiple commands produce问题及解决方案
865 0
The compiler is unable to type-check this expression in reasonable time; try breaking up the express
The compiler is unable to type-check this expression in reasonable time; try breaking up the express
114 0
|
10月前
|
Xcode 10 Error:Multiple commands produce问题及解决方案
Xcode 10 Error:Multiple commands produce问题及解决方案
131 0
Error: Plugin/Preset files are not allowed to export objects, only functions……
Error: Plugin/Preset files are not allowed to export objects, only functions……
Hint: This means that multiple copies of the OpenMP runtime have been linked into the program.
Hint: This means that multiple copies of the OpenMP runtime have been linked into the program.
348 0

热门文章

最新文章

AI助理

你好,我是AI助理

可以解答问题、推荐解决方案等