Warning: duplicate script for target

  • Hi, guys.

    I'm trying to build my project, but getting this error.

    @"Makefile", line 353: warning: duplicate script for target ".obj/Language.o" ignored
    "Makefile", line 356: warning: duplicate script for target ".obj/Procedure.o" ignored@

    The truth is, I have several files Language.{cpp,h} and Procedure.{cpp,h} under different directories. And these files are different. And as I understand this conflict causes the above error.

    My question is: Is there any way to make qmake handle this issue? Or I will have to rename some of these files in order to avoid name duplication?

  • Maybe you can move them to SUBDIRS type of .pro file with staticaly linkage between them? It can help you. In this case each directory will be built into .a file (static library) and after it you can link them all into one executable.

  • Thanks, Denis. What I'm trying to build now (this is actually a static lib) is already a part of SUBDIRS type .pro file. I thought about making the lib's top .pro file with SUBDIRS template, and putting a separate .pro file in all nested directories with OBJECTS_DIR overridden for each directory, so that object files do not conflict. I will keep this solution in mind.

    To my point view, the best solution would be making qmake create the same directory structure under specified OBJECTS_DIR. I mean, let say we have

    @OBJECTS_DIR = .obj
    SOURCES = Type1/.cpp

    and it will be just great, if qmake creates .obj, .obj/Type1, .obj/Type2 directories and puts .o files according to their location. Is this possible?

Log in to reply