installing a c++ wrapper for libcurl on OS X [duplicate] - c++

Really stupid C question.
I'm trying to build the source code here so I can start on modifying it for myself
http://curl.haxx.se/libcurl/c/ftpget.html
I download the file, then run
gcc -o test ftpget.c
and get
Undefined symbols:
"_curl_global_init", referenced from:
_main in ccFchguB.o
"_curl_easy_perform", referenced from:
_main in ccFchguB.o
"_curl_easy_setopt", referenced from:
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
_main in ccFchguB.o
"_curl_easy_cleanup", referenced from:
_main in ccFchguB.o
"_curl_easy_init", referenced from:
_main in ccFchguB.o
"_curl_global_cleanup", referenced from:
_main in ccFchguB.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
which makes no sense to me, because
/usr/local/include/curl/curl.h
exists and has these functions. I'm sure this is some basic c compilation thing I'm missing.
Many thanks for any pointers.

You need to link with the curl library:
gcc -o test ftpget.c -lcurl

Related

How do I fix my current openGL error, my cmakelist may be my issue [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I have included the library <GLUT/glut.h> and all my syntax is correct, yet I am receiving this error.
Undefined symbols for architecture arm64:
"_glBegin", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glClear", referenced from:
displayTriangle() in main.cpp.o
"_glClearColor", referenced from:
_main in main.cpp.o
"_glColor3f", referenced from:
drawTetrahedron(int) in main.cpp.o
"_glEnable", referenced from:
_main in main.cpp.o
"_glEnd", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glFlush", referenced from:
displayTriangle() in main.cpp.o
"_glLoadIdentity", referenced from:
displayTriangle() in main.cpp.o
"_glMatrixMode", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glOrtho", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glVertex3fv", referenced from:
triangle(float*, float*, float*) in main.cpp.o
"_glViewport", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutCreateWindow", referenced from:
_main in main.cpp.o
"_glutDisplayFunc", referenced from:
_main in main.cpp.o
"_glutInit", referenced from:
_main in main.cpp.o
"_glutInitDisplayMode", referenced from:
_main in main.cpp.o
"_glutInitWindowSize", referenced from:
_main in main.cpp.o
"_glutMainLoop", referenced from:
_main in main.cpp.o
"_glutPostRedisplay", referenced from:
reshapeWindow(int, int) in main.cpp.o
"_glutReshapeFunc", referenced from:
_main in main.cpp.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
My cmakefile I feel like is my issue, but I have no idea where to begin.
Please provide more details like your relevant section of CMakeLists.txt for getting more info and getting quicker help from community.
Now, coming to the error logs, it seems you are cross-compiling the source files using a arm-based compilers.
The error message "ld: symbol(s) not found for architecture arm64" looks to me as a linker issue and you should be having the find_package() and linking calls in CMakeLists.txt for OpenGL.
So to start with , you should follow two steps initially and see if it solves your problem:
1. Make sure the CMake build system is pointing to correct compiler tool chain path (arm compilers in here).
Refer official website of CMake for same:
https://cmake.org/cmake/help/book/mastering-cmake/chapter/Cross%20Compiling%20With%20CMake.html
2. Make sure you are linking OpenGL
find_package(OpenGL REQUIRED)
target_include_directories(your_executable_name PUBLIC ${OPENGL_INCLUDE_DIR})
target_link_libraries(your_executable_name PUBLIC ${OPENGL_LIBRARIES})

compiling my code to use mongodb c driver in OSX via xcode

I am trying to make a C application on OSX(10.9.5) which will connect to mongodb and perform CRUD operations. I am using the release 1.3.5 which I downloaded from: https://github.com/mongodb/mongo-c-driver/releases/tag/1.3.5
I was sucessfully able to install mongo on my system. I am making my application which will use the library to perform CRUD operations. I am using Xcode 6.1.1 as my IDEon osx. I have given the appropriate path for header files in the ide and have no warnings or error before the run. I have given search path for dynamic libraries as well so I think linking should be happening fine as well. However when I try to run I get the following error:
Undefined symbols for architecture x86_64:
"_bson_as_json", referenced from:
_main in find.o "_bson_destroy", referenced from:
_main in find.o "_bson_free", referenced from:
_main in find.o "_bson_new", referenced from:
_main in find.o "_mongoc_cleanup", referenced from:
_main in find.o "_mongoc_client_destroy", referenced from:
_main in find.o "_mongoc_client_get_collection", referenced from:
_main in find.o "_mongoc_client_new", referenced from:
_main in find.o "_mongoc_collection_destroy", referenced from:
_main in find.o "_mongoc_collection_find", referenced from:
_main in find.o "_mongoc_cursor_destroy", referenced from:
_main in find.o "_mongoc_cursor_next", referenced from:
_main in find.o "_mongoc_init", referenced from:
_main in find.o ld: symbol(s) not found for architecture x86_64 clang:error: linker command failed with exit code 1 (use -v to see invocation)
Where am I going wrong?
Looks like you've specified the dynamic library path for libmongoc-1.0.so but not the library it depends on, libbson-1.0.so. Both libraries were installed when you built the driver, so you should be able to specify an additional path and your program will link correctly.

FTDI Chip ID on Mac OS Yosemite

I'm trying to get run Sample App from
http://www.ftdichip.com/Support/SoftwareExamples/FTDIChip-ID.htm
for Mac OS.
My problem is to get it compiled for Mac OS Yosemite.
I get this errors after "making" it :
ld: warning: ignoring file ./libftchipid.dylib, missing required architecture x86_64 in file ./libftchipid.dylib (2 slices)
Undefined symbols for architecture x86_64:
"_FTID_Constructor", referenced from:
_main in ChipID-3efebc.o
"_FTID_Destructor", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetChipIDFromHandle", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceChipID", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceDescription", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDeviceSerialNumber", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetDllVersion", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetErrorCodeString", referenced from:
_main in ChipID-3efebc.o
"_FTID_GetNumDevices", referenced from:
_main in ChipID-3efebc.o
ld: symbol(s) not found for architecture x86_64
can someone help?
I have found the way how to read the ID without this library. it is written in EEPROM.
FT_ReadEE (ftHandle, 0x43, &wTemp)
(FT_ReadEE (ftHandle, 0x44, &wTemp)

Compiling zathura pdf plugin on mac ld error

I am trying to install zathura-pdf-poppler-0.2.5 on a Mac OS X running Yosemite. When I try and make, I get the following error:
LD pdf.so
Undefined symbols for architecture x86_64:
"_zathura_document_get_data", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_document_get_password", referenced from:
_pdf_document_open in document.o
"_zathura_document_get_path", referenced from:
_pdf_document_open in document.o
"_zathura_document_information_entry_list_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_information_entry_new", referenced from:
_pdf_document_get_information in meta.o
"_zathura_document_set_data", referenced from:
_pdf_document_open in document.o
_pdf_document_free in document.o
"_zathura_document_set_number_of_pages", referenced from:
_pdf_document_open in document.o
"_zathura_index_element_new", referenced from:
_pdf_document_index_generate in index.o
_build_index in index.o
"_zathura_link_free", referenced from:
_pdf_page_links_get in links.o
"_zathura_link_new", referenced from:
_poppler_link_to_zathura_link in utils.o
"_zathura_page_get_document", referenced from:
_pdf_page_links_get in links.o
_pdf_page_init in page.o
"_zathura_page_get_height", referenced from:
_pdf_page_links_get in links.o
_pdf_page_search_text in search.o
"_zathura_page_get_index", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_data", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_height", referenced from:
_pdf_page_init in page.o
"_zathura_page_set_width", referenced from:
_pdf_page_init in page.o
"_zathura_plugin_add_mimetype", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_name", referenced from:
_zathura_plugin_register in plugin.o
"_zathura_plugin_set_register_functions_function", referenced from:
_zathura_plugin_register in plugin.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [pdf.so] Error 1
I have the following path set in $PKG_CONFIG_PATH:
/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig:/usr/local/Library/ENV/pkgconfig/10.10
Does anyone know how to fix the problem.
Many thanks
I don't know the exact reason that this happens, but I have applied a patch to makefiles and config.mk from MacPort. You can download them in plaintext and use patch Makefile < make.diff and patch config.mk < config.diff to apply the patch.
patch files
I had to change /usr/lib/zathura/pdf.dylib to /usr/lib/zathura/pdf.so after the make install in order to make zathura display pdf files.

Compiling Sphere_2.6a library on Mac OS X

I am trying to compiling sphere_2.6a library on Mac OS X. At the beginning the following parameters are required:
Defined Commands and Options:
Compiler = gcc
Compiler options = -g -m32 -DNARCH_UNIX
Install = cp
Ranlib = ranlib
Archiver = ar ru
The is that I get the following error output:
Undefined symbols for architecture i386:
"_hs_getopt", referenced from:
_main in cc36C6uK.o
"_hs_optind", referenced from:
_main in cc36C6uK.o
"_sp_create_header", referenced from:
_main in cc36C6uK.o
"_sp_fpcopy", referenced from:
_main in cc36C6uK.o
"_sp_get_version", referenced from:
_main in cc36C6uK.o
"_sp_verbose", referenced from:
_main in cc36C6uK.o
"_sp_write_header", referenced from:
_main in cc36C6uK.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [h_add] Error 1
Does anybody know where is the problem?
Thanks a lot,
Giovanni