Doubt about building and linking libraries (C++)

Asked

Viewed 53 times

1

I am using the Codeblocks IDE and would like to use the functions of an external library called Chilkat in my code. I can make the IDE read the header, but when I try to use some function or object in the library, the code does not compile.

The code:

#include <iostream>
#include <CkSpider.h>

using namespace std;

int main(){
    CkSpider miranha;
    miranha.Initialize("www.chilkatsoft.com");
    cout<<"Funciona"<<endl;
return 0;
}

Mistakes are all of the kind:

..\libchilkat-9.5.0.a(ChilkatSocket.o):ChilkatSocket.cpp|| undefined reference to `__imp_WSAStartup'|
..\libchilkat-9.5.0.a(ChilkatSocket.o):ChilkatSocket.cpp|| undefined reference to `__imp_getsockopt'|
..\libchilkat-9.5.0.a(ChilkatSocket.o):ChilkatSocket.cpp|| undefined reference to `__imp_setsockopt'|

Also, on the library page (https://www.chilkatsoft.com/downloads_mingw.asp#getStarted) there are some instructions on how to link and compile the library, but I don’t know where or how to use these parameters:

The -Wl,-enable-auto-import options may be required when linking. Also, link with libcrypt32.a, libws2_32.a, and libdnsapi. a as Shown Below:

g++ -Wl,--enable-auto-import linkSample.cpp -o"linkSample.exe" -L. -lchilkat-9.5.0
    -L/MinGW/lib -lcrypt32 -lws2_32 -ldnsapi

How do I link and compile this library in Codeblocks? Thanks reply in text or even some video that gives me a north.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.