gpt4 book ai didi

c++ - jenkins 在构建 cpp 代码时无法识别错误

转载 作者:行者123 更新时间:2023-11-28 07:27:49 25 4
gpt4 key购买 nike

我正在为我的 CI 服务器使用 jenkins,但是当我想要构建项目时遇到问题,因为 jenkins 无法识别编译错误。这是我的问题:

creating objects directory obj
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c booktest.cpp -o obj/booktest.o
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c reader/bookreadertest.cpp -o obj/reader/bookreadertest.o
g++ -I../src -I third-party/cppunit-1.12.1/include -fPIC -g -Wall -c indexer/indexertest.cpp -o obj/indexer/indexertest.o
indexer/indexertest.cpp: In constructor ‘IndexerTest::IndexerTest()’:
indexer/indexertest.cpp:17:12: error: ‘failMethod’ was not declared in this scope
make: *** [obj/indexer/indexertest.o] Error 1
creating objects directory obj
g++ -I ../src -fPIC -g -Wall -c src/main.cpp -o obj/src/main.o
g++ -o oreallybooks -fPIC -g -Wall obj/src/main.o -L/user/local/lib -L../src/lib -loreally -lm
Finished: SUCCESS



I am using bash files to build and clean the cpp project
I "execute shell" for "build steps" in jenkins and this is the command:

/var/lib/jenkins/jobs/OreallyBooks/workspace/buildProject

"buildProject" is bash file and contains:


!/bin/bash
cd src;
make;
cd ../test;
make;
cd ../ui
make;

有人可以帮助我吗?谢谢大家

最佳答案

如果除最终 make 之外的任何其他操作失败,则 bash 脚本将忽略该错误。

您需要将脚本设置为在第一个错误时失败

#!/bin/bash -e

Stop on first error

关于c++ - jenkins 在构建 cpp 代码时无法识别错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18390235/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com