Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiler Error : Undefined symbols for architecture x86_64 #1411

Open
userM7Lh5621CD0P opened this issue Feb 3, 2022 · 0 comments
Open

Compiler Error : Undefined symbols for architecture x86_64 #1411

userM7Lh5621CD0P opened this issue Feb 3, 2022 · 0 comments

Comments

@userM7Lh5621CD0P
Copy link

using ssdb for long time but with php client. fine in most cases, but there is something I have to iterate many many times .. and with C/C++ I should be able to save a lot of time ..

Compiler failed with error Undefined symbols for architecture x86_64

macOS 10.15.6 Catalina

g++-11 --version

g++-11 (Homebrew GCC 11.2.0_3) 11.2.0

I have followed the steps in the doc readme

g++ -o hello-ssdb -I<path of api/cpp> hello-ssdb.cpp <path of api/cpp>/libssdb-client.a

error :

g++ -o hello-ssdb -I<path of api/cpp> hello-ssdb.cpp <path of api/cpp>/libssdb-client.a

..in libssdb-client.a(SSDB_impl.o)
..in libssdb-client.a(link.o)

ld: symbol(s) not found for architecture x86_64




g++ -o hello-ssdb.cpp hello-ssdb libssdb-client.a

ld: can't link with a main executable file




g++ -o hello-ssdb hello-ssdb.cpp

Undefined symbols for architecture x86_64:
  "__ZN4ssdb6Client7connectEPKci", referenced from:
      _main in cciJLzzz.o
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status

.cpp

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>
#include <vector>
#include "SSDB_client.h"

int main(int argc, char **argv){
    const char *ip = (argc >= 2)? argv[1] : "127.0.0.1";
    int port = (argc >= 3)? atoi(argv[2]) : 8888;
    
    ssdb::Client *client = ssdb::Client::connect(ip, port);

    if(client == NULL){
        printf("fail to connect to server!\n");
    }else{
        printf("ssdb client\n");
    }

    delete client;
    return 0;
}

I would like to connect to the ssdb server ..

I also asked stackoverflow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant