1

I am trying to create C++ dynamic library in XCode 6, very simple one just as a test. I've built it and trid to integrate it to both c++ other app and Obj-C app, but I always get same error ! I've searched everywhere ! I'm loosing my mind ;p

See codes of my library, of my test code and error message below :

Library iOSLibView.cpp :

    #include <iostream>
    #include "iOSLibView.h"


    iOSLibView::iOSLibView(){

    }

    iOSLibView::~iOSLibView(){

    }

void iOSLibView::testLib(){
    std::cout << "First C++ Lib" << std::endl;
}

Library iOSLibView.h :

    #include <stdio.h>

class iOSLibView{
    public :
    iOSLibView();
        ~iOSLibView();

        void testLib();
};

Here's the code in second project which integrates my compiled dynamic library :

Test code :

#include <iostream>
#include "iOSLibView.h"

int main(int argc, const char * argv[]) {
    iOSLibView libTest;
    //libTest.testLib();

    return 0;
}

And error message :

Undefined symbols for architecture x86_64:
  "iOSLibView::iOSLibView()", referenced from:
      _main in main.o
  "iOSLibView::~iOSLibView()", referenced from:
      _main in main.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

In second project, I added .dyn file in build phase, Link binary with libraries and copy files.

I tried too to build my library as a static one and everything works perfectly ! I just meet issues with dynamic libraries...

Thanks for your help !!!

Livevlad
  • 33
  • 6

0 Answers0