Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qt Header not detect #400

Closed
kassane opened this issue Apr 15, 2019 · 1 comment
Closed

Qt Header not detect #400

kassane opened this issue Apr 15, 2019 · 1 comment
Labels
Milestone

Comments

@kassane
Copy link

kassane commented Apr 15, 2019

I tested example of your project using widgets_qt, however when I tried to use it in my project to test it this error occurred:
My project test: here

output:

error: sources\mainwindow.cpp:9:10: fatal error: headers/tcontainer.hpp: No such file or directory
#include "headers/tcontainer.hpp"
^~~~~~~~~~~~~~~~~~~~~~~~

script:

-- add modes: debug and release 
add_rules("mode.debug", "mode.release")

set_languages("c99", "cxx17")

-- add target
target("qt_demo")

    -- add rules
    add_rules("qt.application")

    -- add headers
    --set_headerdir("$(pwd)/headers")
	add_headerfiles("headers/*.hpp")

    -- add files
    add_files("*.cpp", "sources/*.cpp") 

    -- add files with Q_OBJECT meta (only for qt.moc)
    add_files("headers/mainwindow.h") 

    -- add frameworks
    add_frameworks("QtWidgets")

I tried to see more information about the command add_headerfiles but content is in Chinese and I do not understand.
In fact, the set_language command does not change cxx11 to cxx17 or later.

@waruqi
Copy link
Member

waruqi commented Apr 16, 2019

I tried to see more information about the command add_headerfiles but content is in Chinese and I do not understand.

I'm sorry, I have no time to translate documents recently. You can use google translation to look at it

error: sources\mainwindow.cpp:9:10: fatal error: headers/tcontainer.hpp: No such file or directory
#include "headers/tcontainer.hpp"

You need use add_includedirs() to add include search directories.

In fact, the set_language command does not change cxx11 to cxx17 or later.

I have fixed this problem.

You can update dev branch version and try it again.

add_rules("mode.debug", "mode.release")

set_languages("c99", "cxx17")

-- add target
target("qt_demo")

    -- add rules
    add_rules("qt.application")

    -- add header files for `$xmake install`
    add_headerfiles("headers/*.hpp")

    -- add include search directories
    add_includedirs(".")

    -- add files
    add_files("*.cpp", "sources/*.cpp") 

    -- add files with Q_OBJECT meta (only for qt.moc)
    add_files("headers/mainwindow.h") 
    add_files("headers/tcontainer.hpp") 

    -- add frameworks
    add_frameworks("QtWidgets")

@waruqi waruqi added the bug label Apr 16, 2019
@waruqi waruqi added this to the v2.2.6 milestone Apr 16, 2019
@kassane kassane closed this as completed Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants