我是Qt的新手.下载了SourceForge的Qt应用程序的源代码,并尝试构建并运行它.通过QT +=
向.pro文件添加语句来解决一些类似的问题后,我坚持这个:
在尝试构建Qt Creator时,我得到错误说
错误:C1083:无法打开包含文件:'QPrinter':没有这样的文件或目录
我尝试添加QT += printsupport
.pro文件,清理和重建,但这会产生此错误
错误:依赖'..\..\..\..\..\..\..\..\..\..\..\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport\qtprintsupportglobal.h'不存在."
当我去的时候C:\Qt\Qt5.1.1\5.1.1\msvc2012_64\include\QtPrintSupport
,qtprintsupportglobal.h就在那里!
我是一个编程新手,所以请耐心等待我.我搜索并找不到可以回答这个问题的现有主题.我写了下面的代码,它应该根据用户是将安全对象识别为股票还是债券来吐出stock.toString()或bond.toString()罐头短语.但是,我得到"安全无法解决"的编译错误.我想这是一个问题,因为安全对象的类没有在编译时定义.真的吗?如果是这样,有没有办法解决这个问题而不采用反思方法?谢谢!
public static void main(String[] args) {
double thePrice;
double theShares;
double theEarnings;
double theRate;
String securityType;
Scanner in = new Scanner(System.in);
System.out.println("Is it a stock or a bond?");
securityType = in.nextLine();
if (securityType.compareToIgnoreCase("stock") == 0) {
System.out.println("Successfully set to STOCK");
System.out.println("What are the earnings?");
theEarnings = in.nextDouble();
Stock security = new Stock();
security.setEarnings(theEarnings);
}
else if (securityType.compareToIgnoreCase("bond") == 0) {
System.out.println("Successfully set to BOND");
System.out.println("What is the rate?");
theRate = in.nextDouble();
Bond security = new Bond();
security.setRate(theRate);
}
System.out.println("What …
Run Code Online (Sandbox Code Playgroud)