我偶然发现了构建系统介子(http://mesonbuild.com/),由于其简单性和原生Qt支持而吸引了我。
但是,当我按照教程操作时,我收到了错误消息
Build type: native build
Project name: qt5 demo
Native cpp compiler: c++ (clang 8.1.0)
Build machine cpu family: x86_64
Build machine cpu: x86_64
Found pkg-config: /usr/local/bin/pkg-config (0.29.2)
Dependency QtWidgets found: NO
Meson encountered an error in file meson.build, line 3, column 0:
Qt5 native dependency not found (checked pkg-config, qmake-qt5, and qmake)
这很奇怪,因为当我使用Qt Creator时,我可以轻松地创建,编译和执行Qt项目。我正在使用MacOS Sierra。 我可以以某种方式告诉meson qmake所在的位置吗?
答案 0 :(得分:2)
好的,我通过添加
解决了这个问题interface Shape {
public void draw();
}
class Triangle implements Shape {
public void draw() {
//Draw Triangle
}
}
class Circle implements Shape {
public void draw() {
//Draw Circle
}
}
class Drawing { private Shape shape;
public Shape getShape() {
return shape;
}
public void setShape(Shape shape) {
this.shape=shape;
}
}
class App {
public static void main(String args[]) {
ApplicationContext context = new ClassPathXMLApplicationContext("spring.xml");
Drawing drawing = context.get("drawing");
drawing.draw(); // I want to automatically inject Triangle as default shape inside this drawing object.
}
}
到我的.bash_profile文件,其中是包含qt二进制文件的文件夹的路径,例如qmake。