Problem linking addon after modifying it

#1

Hello forum,

I have been modifying a version of ofxBlackMagic lately by duplicating it and renaming the addon ofxBlackMagicFork in my addons folder. I tried to re-connect a project to this forked version, and everything seems to work fine: when I “follow the symbols under cursor” (I’m in Ubuntu using Qt) it links correctly to the modified file and so on. Everything seems to be connected fine, but when I run the application it says

/home/antonio/dev/of_v0.10.1_linux64gcc6_release/apps/myApps/trigger4/src/Editor.h:45: error: undefined reference to 'ofxBlackMagic::ofxBlackMagic()'

And that on every single line where ofxBlackMagic is referenced. I didn’t change the name of the object nor the methods, I only added new stuff. Any idea on what could be happening? I also included the new header at the beggining, which was also tricky because qt didn’t normalize the path, so I had to include it as

#include "../../../addons/ofxBlackmagicFork/src/ofxBlackMagic.h"

Am I missing something?

Thank you!

#2

That seems like you are not really including the addon. the code completion somehow is working but the addon is not being included in the search paths, that’s why you need to use the full relative path and the cpp is not being compiled

how are you adding the addon to the project? you should have in the qbs file a section with addons where you can add it

#3

Hi Arturo. This is my qbs file:

import qbs
import qbs.Process
import qbs.File
import qbs.FileInfo
import qbs.TextFile
import "../../../libs/openFrameworksCompiled/project/qtcreator/ofApp.qbs" as ofApp

Project{
    property string of_root: '../../..'

    ofApp {
        name: { return FileInfo.baseName(sourceDirectory) }

        files: [
            'src/Editor.cpp',
            'src/Editor.h',
            'src/main.cpp',
            'src/ofApp.cpp',
            'src/ofApp.h',
        ]

        // This project is using addons.make to include the addons
        // since it was imported from old code. To change it to include
        // the addons from the qbs file change the following lines to
        // the list of used addons in array format. eg:
        //
         of.addons: [
            'ofxDatGui',
            'ofxSimpleSerial',
            'ofxBlackmagicFork',
            'ofxImageSequenceRecorder'
        ]

        // additional flags for the project. the of module sets some
        // flags by default to add the core libraries, search paths...
        // this flags can be augmented through the following properties:
        of.pkgConfigs: []       // list of additional system pkgs to include
        of.includePaths: []     // include search paths
        of.cFlags: [
            '-std=c++11' ,
            '-Wno-multichar',
//            '-I',
            '-fno-rtti',
            '-Wall',
            '-g'
        ]           // flags passed to the c compiler
        of.cxxFlags: [
            '-std=c++0x',
            '-pthread'
        ]         // flags passed to the c++ compiler
        of.linkerFlags: [
            '-lm',
            '-ldl',
            '-lpthread',
            '-lpng'
        ]      // flags passed to the linker
        of.defines: []          // defines are passed as -D to the compiler
        // and can be checked with #ifdef or #if in the code
        of.frameworks: []       // osx only, additional frameworks to link with the project
        of.staticLibraries: []  // static libraries
        of.dynamicLibraries: [
            /*'/usr/lib/x86_64-linux-gnu/libpng.so',
            '-ldl',
            '-pthread' */
        ] // dynamic libraries

        // create a console window when the application start
        consoleApplication: false

        // other flags can be set through the cpp module: http://doc.qt.io/qbs/cpp-module.html
        // eg: this will enable ccache when compiling
        //
        // cpp.compilerWrapper: 'ccache'

        Depends{
            name: "cpp"
        }

        // common rules that parse the include search paths, core libraries...
        Depends{
            name: "of"
        }

        // dependency with the OF library
        Depends{
            name: "openFrameworks"
        }
    }

    property bool makeOF: true  // use makfiles to compile the OF library
    // will compile OF only once for all your projects
    // otherwise compiled per project with qbs

    property bool precompileOfMain: false  // precompile ofMain.h
    // faster to recompile when including ofMain.h
    // but might use a lot of space per project

    references: [FileInfo.joinPaths(of_root, "/libs/openFrameworksCompiled/project/qtcreator/openFrameworks.qbs")]
}

ofxBlackmagicFork is the copy that I am modifying and it is also in my addons folder. I have tried to reparse the qbs file but something doesn’t seem to be working.

#4

yes that should work. not sure why it wouldn’t. Do you get any errors when reparsing the qbs or right after opening the project?

#5

Thank you for your reply. No, I don’t get any errors but the program still fails to build. It feels as there would be a cached version of the qbs file somewhere that qt cannot update, no idea.