【发布时间】:2017-12-05 10:17:28
【问题描述】:
我创建了一个 GitHub test repo 来玩 Travis CI,它运行良好,直到我尝试使用外部依赖项。在.travis.yml我有
install:
- sudo apt-get install libsfml-dev
并且该命令在 Travis 机器上成功执行,但在编译时,我收到类似
的错误main.cpp: In function ‘int main()’:
main.cpp:6:5: error: ‘CircleShape’ is not a member of ‘sf’
main.cpp:6:21: error: expected ‘;’ before ‘shape’
main.cpp:7:5: error: ‘shape’ was not declared in this scope
在g++ 和
main.cpp:6:9: error: no member named 'CircleShape' in namespace 'sf'
sf::CircleShape shape(100.f);
~~~~^
main.cpp:7:5: error: use of undeclared identifier 'shape'
shape.setFillColor(sf::Color::Green);
^
在clang++.
无论是在我的 Windows 机器上还是在我的 Linux VM 上,我都没有收到这些错误,代码是 SFML 教程中的示例代码。
install 命令似乎没有任何问题,因为编译器不会说明错误的标头。
是什么导致了这些错误?我该如何修复它们? install 命令是不是我做错了什么?
【问题讨论】:
-
据我回忆,Travis 使用的是非常老的 Ubuntu 12.04。也许它安装的 SFML 版本有问题?
-
啊,有趣的提示;我会调查的
-
@GoodDeeds 太棒了,它有效!没想到这么简单
-
好。顺便说一句,标题如何与问题的其余部分相关联?也许可以对其进行编辑以使其更容易找到?
-
@GoodDeeds 问题是我不知道原因是什么,我真的不知道更合适的标题。如果有人知道,请编辑它
标签: c++ linux dependencies travis-ci