Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QT. QImage: No such file or directory

QT. QImage: No such file or directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 1.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    theNinthElement
    wrote on last edited by
    #1

    Hi all,

    I am trying to run a C++ code from Cython and get this error message.

    I have QT installed and all the files and libraries intact.
    I tried to run the C++ project from qt creator and it works but when I try to run it from Cython I get this error.

    $python setup.py build_ext --inplace
    running build_ext
    building 'c_inpainting' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/include 
    -fPIC -I. -I/home/xxxx/miniconda3/include/python3.7m -c c_inpainting.cpp -o 
    build/temp.linux-x86_64-3.7/c_inpainting.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but 
    not for C++
    In file included from imgCodecs/inpainting.cpp:3,
                 from c_inpainting.cpp:651:
    imgCodecs/supplementary_functions.h:6:10: fatal error: QImage: No such file or 
    directory
    6 | #include <QImage>
      |          ^~~~~~~~
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    

    Furthere I tried to do a cmake of the file normally and on running make I get this error

    [  3%] Building CXX object CMakeFiles/imgCodecs.dir/cannylib/CannyEdgeDetector.cpp.o
    [  7%] Building CXX object CMakeFiles/imgCodecs.dir/niftilib/nifti1_io.cpp.o
    [ 11%] Building CXX object CMakeFiles/imgCodecs.dir/niftilib/znzlib.cpp.o
    [ 15%] Building CXX object CMakeFiles/imgCodecs.dir/chain_coding.cpp.o
    In file included from 
    /home/xxxx/worksapce/xx/python/imgCodecs/chain_coding.cpp:1:
    /home/xxxx/worksapce/xx/python/imgCodecs/chain_coding.h:4:10: fatal 
    error: QDialog: No such file or directory
    4 | #include <QDialog>
      |          ^~~~~~~~~
    compilation terminated.
    make[2]: *** [CMakeFiles/imgCodecs.dir/build.make:118: 
    CMakeFiles/imgCodecs.dir/chain_coding.cpp.o] Error 1
    make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/imgCodecs.dir/all] Error 2
    make: *** [Makefile:91: all] Error 2
    
    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You should maybe ask the library devs what you need where. What library are you trying to compile? What was the cmake output during configure? Was Qt properly found?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • T Offline
        T Offline
        theNinthElement
        wrote on last edited by theNinthElement
        #3

        How should I include the library dev guys here?

        I am trying to include QDialog QMessageBox QPixmap QFileDialog QFile QImage. which the code uses.

        this is my MakeFile2 generated.

         CMAKE generated file: DO NOT EDIT!
        # Generated by "Unix Makefiles" Generator, CMake Version 3.22
        
        # Default target executed when no arguments are given to make.
        default_target: all
        .PHONY : default_target
        
        #=============================================================================
        # Special targets provided by cmake.
        
        # Disable implicit rules so canonical targets will work.
        .SUFFIXES:
        
        # Disable VCS-based implicit rules.
        % : %,v
        
        # Disable VCS-based implicit rules.
        % : RCS/%
        
        # Disable VCS-based implicit rules.
        % : RCS/%,v
        
        # Disable VCS-based implicit rules.
        % : SCCS/s.%
        
        # Disable VCS-based implicit rules.
        % : s.%
        
        .SUFFIXES: .hpux_make_needs_suffix_list
        
        # Command-line flag to silence nested $(MAKE).
        $(VERBOSE)MAKESILENT = -s
        
        #Suppress display of executed commands.
        $(VERBOSE).SILENT:
        
        # A target that is always out of date.
        cmake_force:
        .PHONY : cmake_force
        
        #=============================================================================
        # Set environment variables for the build.
        
        # The shell in which to execute make rules.
        SHELL = /bin/sh
        
        # The CMake executable.
        CMAKE_COMMAND = /usr/bin/cmake
        
        # The command to remove a file.
        RM = /usr/bin/cmake -E rm -f
        
        # Escaping for special characters.
        EQUALS = =
        
        # The top-level source directory on which CMake was run.
        CMAKE_SOURCE_DIR = /home/xxxx/worksapce/xxxx/python/imgCodecs
        
        # The top-level build directory on which CMake was run.
        CMAKE_BINARY_DIR = /home/xxxx/worksapce/xxxx/python/imgCodecs/build
        
        #=============================================================================
        # Directory level rules for the build root directory
        
        # The main recursive "all" target.
        all: CMakeFiles/imgCodecs.dir/all
        .PHONY : all
        
        # The main recursive "preinstall" target.
        preinstall:
        .PHONY : preinstall
        
        # The main recursive "clean" target.
        clean: CMakeFiles/imgCodecs.dir/clean
        .PHONY : clean
        
        #=============================================================================
        # Target rules for target CMakeFiles/imgCodecs.dir
        
        # All Build rule for target.
        CMakeFiles/imgCodecs.dir/all:
        	$(MAKE) $(MAKESILENT) -f CMakeFiles/imgCodecs.dir/build.make CMakeFiles/imgCodecs.dir/depend
        	$(MAKE) $(MAKESILENT) -f CMakeFiles/imgCodecs.dir/build.make CMakeFiles/imgCodecs.dir/build
        	@$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --progress-dir=/home/xxxx/worksapce/xxxx/python/imgCodecs/build/CMakeFiles --progress-num=1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26 "Built target imgCodecs"
        .PHONY : CMakeFiles/imgCodecs.dir/all
        
        # Build rule for subdir invocation for target.
        CMakeFiles/imgCodecs.dir/rule: cmake_check_build_system
        	$(CMAKE_COMMAND) -E cmake_progress_start /home/xxxx/worksapce/xxxx/python/imgCodecs/build/CMakeFiles 26
        	$(MAKE) $(MAKESILENT) -f CMakeFiles/Makefile2 CMakeFiles/imgCodecs.dir/all
        	$(CMAKE_COMMAND) -E cmake_progress_start /home/xxxx/worksapce/xxxx/python/imgCodecs/build/CMakeFiles 0
        .PHONY : CMakeFiles/imgCodecs.dir/rule
        
        # Convenience name for target.
        imgCodecs: CMakeFiles/imgCodecs.dir/rule
        .PHONY : imgCodecs
        
        # clean rule for target.
        CMakeFiles/imgCodecs.dir/clean:
        	$(MAKE) $(MAKESILENT) -f CMakeFiles/imgCodecs.dir/build.make CMakeFiles/imgCodecs.dir/clean
        .PHONY : CMakeFiles/imgCodecs.dir/clean
        
        #=============================================================================
        # Special targets to cleanup operation of make.
        
        # Special rule to run CMake to check the build system integrity.
        # No rule that depends on this can have commands that come from listfiles
        # because they might be regenerated.
        cmake_check_build_system:
        	$(CMAKE_COMMAND) -S$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
        .PHONY : cmake_check_build_system
        
        
        1 Reply Last reply
        0
        • Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by Christian Ehrlicher
          #4

          I don't want to see your Makefile. This can't read nor understand anyone.
          What are you trying to achieve? How does your CMakeLists.txt look like - are you searching for the Qt libraries there? Where is your main.cpp where you instantiate your QApplication object?

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          1 Reply Last reply
          0
          • T Offline
            T Offline
            theNinthElement
            wrote on last edited by
            #5

            thats my CMakeList.txt. I am not searching for the QT libraries there yet.

            cmake_minimum_required(VERSION 3.20)
            project(imgCodecs)
            
            set(CMAKE_CXX_STANDARD 14)
            
            #add_definitions(-DQT_NO_KEYWORDS)
            
            include_directories(.)
            include_directories(cannylib)
            include_directories(niftilib)
            
            add_executable(imgCodecs
                    cannylib/CannyEdgeDetector.cpp
                    cannylib/CannyEdgeDetector.h
                    niftilib/ctpl_stl.h
                    niftilib/nifti1.h
                    niftilib/nifti1_io.cpp
                    niftilib/nifti1_io.h
                    niftilib/znzlib.cpp
                    niftilib/znzlib.h
                    chain_coding.cpp
                    chain_coding.h
                    derivatives.cpp
                    derivatives.h
                    diffresdialog.cpp
                    diffresdialog.h
                    directneighbordilationdialog.cpp
                    directneighbordilationdialog.h
                    eed_4_4d_dialog.cpp
                    eed_4_4d_dialog.h
                    eedinpaintingdialog.cpp
                    eedinpaintingdialog.h
                    eedsmoothingdialog.cpp
                    eedsmoothingdialog.h
                    fed.cpp
                    fed.h
                    fed_kappa.h
                    foeedinpaintingdialog.cpp
                    foeedinpaintingdialog.h
                    imgcodecs.cpp
                    imgcodecs.h
                    inpainting.cpp
                    inpainting.h
                    main.cpp
                    masks.cpp
                    masks.h
                    primizedialog.cpp
                    primizedialog.h
                    r_ilh_0_dialog.cpp
                    r_ilh_0_dialog.h
                    randommask.cpp
                    randommask.h
                    reggridmaskdialog.cpp
                    reggridmaskdialog.h
                    slicewiseeeddialog.cpp
                    slicewiseeeddialog.h
                    smoothing.cpp
                    smoothing.h
                    supplementary_functions.cpp
                    supplementary_functions.h
                    timeaxiscombinedialog.cpp
                    timeaxiscombinedialog.h
                    xorresdialog.cpp
                    xorresdialog.h)
            

            Here is my main.cpp

            #include "imgcodecs.h"
            #include <QApplication>
            
            int main(int argc, char *argv[])
            {
                QApplication a(argc, argv);
                ImgCodecs w;
                w.show();
            
                return a.exec();
            }
            
            
            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              So you should do this like explained e.g. here.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved