【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 文件,确保所有的流控制语句都正确嵌套。



相关文章
|
7月前
|
人工智能 机器人 测试技术
【CMake报错】报错:Flow control statements are not properly nested.
【CMake报错】报错:Flow control statements are not properly nested.
|
5月前
|
JavaScript
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 Java 数据库连接
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
227 0
|
并行计算
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.
294 0
PowerDesigner在生成SQL时报错Generation aborted due to errors detected during the verification of the mod
PowerDesigner在生成SQL时报错Generation aborted due to errors detected during the verification of the mod
610 0
PowerDesigner在生成SQL时报错Generation aborted due to errors detected during the verification of the mod
|
Oracle 关系型数据库 Unix
|
JavaScript 前端开发
Guidelines for Function Compute Development - Troubleshoot Timeout Issues
Endless codes and endless bugs When you write code, you may inadvertently introduce some hidden bugs, even if you test a large proportion of the codes to the maximum extent possible.
1644 0
|
SQL Java 关系型数据库
hive_异常_01_ Terminal initialization failed; falling back to unsupported
一、异常现象 hive初始化数据库时,在执行了 schematool -initSchema -dbType mysql 这个命令时,终端抛出如下异常: [ray@rayner bin]$ schematool -initSchema -dbType mysql Met...
1956 0