Question:
I can not compile on linux or windows with NetBeans C++ or CodeBlock C++.......
main.cpp:7: undefined reference toTested with NetBeans and Code::Blocks..... Help......CkSocket_Create()' main.cpp:9: undefined reference to
CkSocket_Dispose(void*)'g++ -m32 -o main.o -L/chilkat-9.4.0-mingw -lchilkat-9.4.0 -Wl,--enable-auto-import
(I'm not sure why one would choose to use the Chilkat "C" API within a C++ program because it would be more natural to use the Chilkat C++ classes instead.)
To include the Chilkat "C" API headers within a C++ source file, make sure to wrap it in extern "C", such as the following:
extern "C" { // Include Chilkat "C" headers here... }If your application source is compiled as a C++ source, then the names are mangled according to the C++ compiler's name decoration rules. See http://en.wikipedia.org/wiki/Name_mangling A "C" compiler does not mangle names. Therefore, if you compile "C" declarations as a C++ source, you'll get undefined references and/or unresolved externals.