新手问题QT C ++ - Qimage不工作? [英] Newbie problem with QT C++ - Qimage dont work?

查看:513
本文介绍了新手问题QT C ++ - Qimage不工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试从控制台应用程序读取图像中的像素:

I am trying to do console application to read pixels from image:

#include <QtCore/QCoreApplication>
#include <QtGui/QImage>

#include <iostream>

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    QImage *img = new QImage("adadad.jpg");

    //std::cout << "Type filename:" << std::endl;
    img->isNull();
    return a.exec();
}

这不起作用我得到:编译,但仍然存在的文件...)

File not found: tmp/obj/debug_shared/main.o:: In function `main':

发生了什么?是否不能使用Qimage与控制台应用程序?!

What is going on? Is it impossible to use Qimage with console app?!

编辑:
screen

推荐答案

在控制台应用程序中使用QImage,您必须确保QtGui配置了。如果您选择了控制台应用程序,您的.pro文件可能包含

It is possible to use QImage in a console application, you must make sure that QtGui is configured though. If you chose a console app, your .pro file might contain something like

CONFIG += console
QT -= gui

如果是这样,请删除QT - = gui行。

If that's the case, remove the QT -= gui line.

这篇关于新手问题QT C ++ - Qimage不工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆