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 8775779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:53:26+00:00 2026-06-13T18:53:26+00:00

I have a project with some folders which happen to contain source files with

  • 0

I have a project with some folders which happen to contain source files with the same names.

My source tree looks like this:

project.pro

foo/
    conflict.h
    conflict.cpp

bar/
    conflict.h
    conflict.cpp

some.h
other.h
files.h
main.cpp

Per default, qmake generates a Makefile which will produce a build tree like this:

conflict.o
main.o
target

Where conflict.o is the object file resulting for both foo/conflict.cpp and foo/conflict.h.

I can’t to change their names because they are generated using an external tool and forcing different file names would imply to change their contents, so this is not an option.

I also don’t want to use qmake SUBDIRS template because this would imply that (1) every subdir is built separately as a library and thus very much complicate the overall build process (in my eyes at least) and (2) in the top level directory I can’t have any source files. Or am I wrong?

Can’t I just tell qmake to write the object files into separate directories within the build directory? So my build tree will look like this:

foo/
    conflict.o

bar/
    conflict.o

main.o
target

Or are there any other solutions neither requiring to rename the source files nor introducing something complicated like static libraries? I just can’t believe that Qt didn’t solve this (in my eyes simple) problem for years. (I already hat this problem 4 years ago but could rename the files in that project, while here I can’t.)

If it’s important: I use Qt 4.8 on both Ubuntu with G++ and Windows with mingw32.

  • 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-13T18:53:27+00:00Added an answer on June 13, 2026 at 6:53 pm

    Are you tied to qmake? If not, an alternative could be to use cmake. I just verified your usecase with a simple CMakeLists.txt like

    cmake_minimum_required (VERSION 2.6)
    project (conflict)
    add_executable(conflict foo/conflict.cpp bar/conflict.cpp main.cpp)
    

    which even included a source file in the top level directory (main.cpp). This properly builds the executable – the object files are created in sub directories like

    ./CMakeFiles/conflict.dir/main.cpp.o
    ./CMakeFiles/conflict.dir/bar/conflict.cpp.o
    ./CMakeFiles/conflict.dir/foo/conflict.cpp.o
    

    cmake also includes support for Qt4, to automatically pull in the required include paths and libraries. It might require some effort to migrate from qmake to cmake, but given the requirements you have I would give it a try.

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

Sidebar

Related Questions

I have a large project but I need only some folders in my svn
I have some data files in the resources/ folder for my Rubymotion project. How
I have a project which has some lib's associated with it (in Build Path).
I have a project that requires some configuration files. I want to keep the
I have an OS design project with some subprojects, I would like to try
I have a web project which the folders are constructed within the areas .
Hello all I have some very important system files which I want to protect
i have a project in eclipse which was on SVN but some how its
I have a problem with R in android. I have a project with some
I have done some project in Irrlicht and it compiles all well, however when

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.