在错误的目录中构建文件?

问题描述 投票:0回答:1

我是 C/C++ 初学者,需要这方面的帮助:

我正在使用以下方法在 MacOS 上生成构建文件:

mkdir build
cd build 
cmake .. 

并得到这个:

-- The CXX compiler identification is AppleClang 13.0.0.13000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenSSL: /opt/homebrew/lib/libcrypto.dylib (found version "3.2.1")  
-- Configuring done (0.8s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/avissataghizadeh/Desktop/rn-praxis/build

然后当我尝试运行它时:

AILED test_praxis3.py::test_stabilize - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_notify - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_successor_update - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_join - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_join_forward - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_join_react - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
FAILED test_praxis3.py::test_dht - FileNotFoundError: [Errno 2] No such file or directory: 'build/webserver'
========================================================== 7 failed in 0.28s ===========================================================
avissataghizadeh@Air-von-Avissa test % 

我认为问题在于项目层次结构,因为 Webserver.c 文件不在构建目录中。但我不确定。有人可以帮忙吗?我添加了项目层次结构的屏幕截图

Project hierarchy screenshoot

c cmake build directory file-not-found
1个回答
0
投票

从您发布的内容来看,您的问题似乎与@zaufi 在您原始帖子下的评论中所说的内容更多有关。

No such file or directory: 'build/webserver'

我不知道你的项目的结构或者它依赖什么依赖项,但是如果你的程序依赖于你的构建目录中的目录或文件或程序,你应该把它放在那里。

如果

webserver
是您的程序名称,请查看是否可以找到一种方法在构建时设置可执行文件的名称。然后仔细检查以确保您的构建目录中有名为
webserver
的内容。

希望这有帮助!

© www.soinside.com 2019 - 2024. All rights reserved.