Can't solve ofxLaunchControlXL's linker error

Please tell me what I did wrong.

Hi I’m new to oF and programming.

I’ve been trying to develop my VJ application and add [ofxLaunchControlXL] (https://github.com/2bbb/ofxLaunchControlXL) to the application. However, I there is one error and I can’t solve it:

ld: 2 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation) 

That addon’s example has only cpp file, and there was no problem while compiling.

But if I change these 3 files main.cpp, ofApp.h, ofApp.cpp, that error appears.So I guess the reason is because I rewrote to those 3 files.

Please tell me what I did wrong.

ofApp.h

#pragma once

#include "ofMain.h"
#include "ofxLaunchControl.h"

class ofApp : public ofBaseApp{
    
public:
    void setup();
    void update();
    void draw();
    
    void keyPressed(int key);
    void keyReleased(int key);
    void mouseMoved(int x, int y );
    void mouseDragged(int x, int y, int button);
    void mousePressed(int x, int y, int button);
    void mouseReleased(int x, int y, int button);
    void mouseEntered(int x, int y);
    void mouseExited(int x, int y);
    void windowResized(int w, int h);
    void dragEvent(ofDragInfo dragInfo);
    void gotMessage(ofMessage msg);
    
    ofxLaunchControlXL control;
    ofFloatColor fg, bg;
    bool toggle_button, not_toggle_button;
    int fader_values[8];
    
};

ofApp.cpp

void ofApp::setup(){
    control.setup();
    
    control.registerValue(fg.r, ofxLaunchControlXL::TopKnob, 0, ofxLaunchControlXL::LedColorGreen);
    control.registerValue(fg.g, ofxLaunchControlXL::TopKnob, 1, ofxLaunchControlXL::LedColorRed);
    control.registerValue(fg.b, ofxLaunchControlXL::TopKnob, 2, ofxLaunchControlXL::LedColorYellow);
    control.registerValue(bg.r, ofxLaunchControlXL::CenterKnob, 0, ofxLaunchControlXL::LedColorGreenFullRange);
    control.registerValue(bg.g, ofxLaunchControlXL::CenterKnob, 1, ofxLaunchControlXL::LedColorRedFullRange);
    control.registerValue(bg.b, ofxLaunchControlXL::CenterKnob, 2, ofxLaunchControlXL::LedColorYellowFullRange);
    control.registerValueAsToggle(toggle_button, ofxLaunchControlXL::TopButton, 0, ofxLaunchControlXL::LedColorGreen);
    control.registerValue(not_toggle_button, ofxLaunchControlXL::TopButton, 1, ofxLaunchControlXL::LedColorRedFullRange);
    for(int i = 0; i < 8; i++) {
        control.registerValue(fader_values[i], ofxLaunchControlXL::Fader, i);
    }
    control.setTemplate(0);
    ofSetRectMode(OF_RECTMODE_CENTER);
}

Thanks in advance.

that error usually happens because you add 2 files with the same functions or class. check that you don’t have 2 ofApp or main in your project

1 Like

Hi yuma_taesu,

I got the same problem. Did you find a solution ?

As I made a new project with the projectGenerator and brought sections from the example (which has everything in the file main.cpp), there is no specific “2 ofApp or main” as suggested by arturo. Maybe there are inside the ofxLaunchControlXL src ?

@yuma_taesu

it is bug of my addon.
i didn’t know issue on forum…
and i did fix it now.
please check it if you still have want to use…

thanks

Yes, it is fixed now : https://github.com/2bbb/ofxLaunchControlXL/issues/3

@2bit
I’ve solved it myself quite a long time ago… however I should have opened the issue
This addon is very useful!! Of course, I still use it now.

@Anas_G
Sorry for leaving this post alone.
thanks!!!:beer:

@yuma_taesu

it’s great!

please open issue/PR if you meet error/bug next time!

thanks!