Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8678383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T20:42:24+00:00 2026-06-12T20:42:24+00:00

I have some previously written headers and I would like to include them in

  • 0

I have some previously written headers and I would like to include them in my Qt project. How can I do that without copying them in place?

After I added them with “Add Existing Files…” I can’t seem to be able to #include my headers. Neither #include “header.h” nor #include “fullpath/header.h” works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T20:42:25+00:00Added an answer on June 12, 2026 at 8:42 pm

    You have to add an INCLUDEPATH to your .pro file:

    INCLUDEPATH += ...
    

    Then you can include the header using #include <...> syntax (not "..."), since then the compiler searches for it in the include path rather than the current working directory which is your project’s source folder.

    Use the relative path of the header within your include path, not relative from within your project’s source folder.

    #include <header.h>
    

    By the way, adding headers to your project is only needed when they are Qt headers using the Qt meta object system. The ones which define a QObject derived class are passed to the moc, this is why a Qt project needs to specify the headers. The real compilation process doesn’t need to know which headers are in your project (it just includes them when it sees a #include directive).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some text lines like that : vt_wildshade2^508^508 vt_ailleurs2^1188^1188 ... vt_high2^13652^13652 Is it
I have some code that looks like this: GLfloat c[4]; glGetFloatv(GL_CURRENT_COLOR, c); I expect
I have a windows service written in C# .NET framework 3.5 and would like
I have been writing some a django project / app that initiates some test
I have written some code that makes use of an open source library to
At some point of my program I have an atom formed by what previously
I have code examples from some of my previous work that help me to
I have some arbitrary pixel data that I want to save as a PNG.
I have some tables roughly like so: Client: id name Employee id name Email
I have a JSON WCF service and I have written some javascript to access

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.