My Xcode project contains C++ static libraries that compiled for iOS.
The C++ code includes <experimental/filesystem> that is not part of the Xcode C++ lib. I manage to compile the c++ code to static lib with Xcode 9-beta command line tools (With Xcode 8.3.3 I didn't manage to compile the c++ code since filesystem was not part of c++ lib).
When including the static lib in my project I'm getting:
Undefined symbols for architecture arm64:
std::experimental::filesystem::v1::__status(std::experimental::filesystem::v1::path..
This is not specific arm64 issue. Probably need to use C++ lib with this implementation or include filesystem lib but didn't manage to find a way to do it.
Do you have any idea how to solve this issue?
Related
i am looking for solution of merging my own library with third party library on ios platform.
i have my desktop project with some C++ functions, which i want to use in ios app. In original this project use fftw3 lib, which i built from sources on windows. fftw3 is included as static lib(.lib file) with suitable header:
#include <fftw3.h>
I made ios static c++ lib from VS template and transfered my code to there. But there is no library depencies option in the project settings, so i can't add fftw3 lib to this project. The project is sucsefully building(with adding fftw3 header inside project) on ARM64 platform in ".a" file on remoted Mac, but of course it failed, when it used by client code. I have a lot of errors like this:
Undefined symbols for architecture arm64:
"_fftwf_alloc_complex", referenced from:
Also i built fftw3 lib on Mac with arm64 platform and got libfftw3.a file. After that i tried to merge these libs toghether with libtool:
libtool -static -o new.a mylib.a libfftw3.a
But i have got the same errors. What am I doing wrong?
I am writing a program that uses the hashlib++ library (or will use it) but I don't want to add all of it's source files to my project because it's huge. Is there anyway to link to the hashlib++ source files so that I can use it in my project? I've tried linking to the header directly with a simple
#include "path/to/hashlibpp.h"
But I receive a nifty error for it as soon as I attempt to call any functions from the library. For example:
undefined reference to `sha1wrapper::sha1wrapper()
I am using the Code::Blocks IDE and GCC compiler.
First you have to have the library installed on your machine, already compiled into a static or dynamic library file. You can install from source, or you may find a pre-built package available for your OS (depending on which OS you are using). You will need to know the name of the library.
In the case of hashlib++ they have provided instructions to build a static library from source in their README; see section 3.2.
In most cases, dynamic linking is the best choice. This means that the library is linked with the library at run time, instead of adding the library to your executable when it is compiled (which would make your executable file much larger).
Unfortunately, according to their README.txt, hashlib is only available as a static lib, which limits your choices.
When compiling a program on the command line using gcc, the '-l' option links in a library:
gcc -o MyProg -lhl++ MyProg.c
When using an IDE like Code::Blocks, you normally have to specify the libraries to be linked. See this answer for details on how to do this with Code::Blocks.
I'm writing a c++ program that is dependent on a c/c++ 3rd-party library. I compiled the 3rd-party library as a static library both on windows and linux. My code works correctly on linux, but on windows there's linking error indicating that my code fails to resolve the symbols in the 3rd-party library.
After some debugging, I found that the unresolved references are non-inline functions in that library and inline functions can be resolved (I've tested). Originally I thought it's the incompatibility between gcc and msvc, because I compiled the .lib files using msvc while attempted to compile my code with g++ through mingw. I recompiled the library with g++ on windows and there's the same problem.
Any idea what might be the solution?
=========Edit===============
Just to clarify, the 3rd-party library is not templated.
I found the problem: I put both the lib*.a (generated on linux) and .lib (generated on windows) of the 3rd-party library in the same directory, because I want this code to be cross-platform. While compiling my code in windows with g++, it seems link to the lib.a files in priority which leads to "unresolved symbols" error. I deleted the lib*.a files and g++ now link to the *.lib file, and works correctly.
I would like it to operate similarly to how the normal test framework works - if you the tests from the Product->Run tests menu item, the output should appear in the left sidebar window.
I found a guide for using xcode 3 with boost test, but couldn't figure out how to translate those instructions for xcode 4 (if it is even possible).
Finally, I'm building an iPhone application. I could get boost running using the #include <boost/test/included/unit_test.hpp>, however it is pretty slow. Using the standard #include <boost/test/unit_test.hpp> results in link errors due to the library being built for the wrong architecture.
You should build the boost library to a static library ".a" using .configure and make.
According to this:
No special build options or macro definitions are required to build
the static library. Using the Boost.Build system you can build the
static library with the following command from libs/test/build
directory:
bjam [-sTOOLS=] {-sBUILD=boost_unit_test_framework}
This library or libraries and their respective headers need to be added to the project. (Two built versions are needed, one i386 for the simulator and one ARM for devices).
The static library is imported from Link Binary with Libraries in
Build Phases.
Also you need to tell XCode which of these to use, you
can do this by setting contidional build settings in `Build settings-
Library search paths. Above this line is where you add the Header
Search Path to the boost header files.
After this you should be able to include the headers (Added above) in C++ or objective-C++ code of yours. (To make Obj-C files Obj-C++ files you need to change all deppendent .m files to .mm)
If there is a some problems after this, switching Compiler or standard library for C++ in Build Settings might help.
I'm trying to link cpgui to my library, which links to SFML. I use code::blocks so I had to make my own project for that library, and as it requires SFML I statically linked to SFML in that library and compiled it fine.
Now, when I attempt to statically link that library to my library, I get a bunch of undefined references to SFML when I compile my project. Even if I linked to SFML in both projects, what's happening?
As you guessed, you can make it simpler by adding the library files directly to the project.
Another solution as suggested by AJG85 would have been to link the library -- after taking care of conflicting dependencies.
Use relevant documentation as suggested by answer to How do I link a library to my project in CodeBlocks & GCC without adding the library source to my project