linker

Linker error - Undefined symbols std::string::c_str() const on macos with libboost_thread?

百般思念 提交于 2020-01-13 09:43:46
问题 I installed boost 1.55.0 from homebrew on macos mavericks. Getting a linker exception - not finding std::string::c_str() which I don't understand why. Could this be a problem with homebrew? I tried compiling boost 1.55.0 directly from boost and it doesn't even build on macos. This little bit of code: #include <iostream> #include <unordered_map> #include <vector> #include <boost/thread/tss.hpp> typedef std::unordered_map<std::string, std::string> StringMap; static boost::thread_specific_ptr

Linker error - Undefined symbols std::string::c_str() const on macos with libboost_thread?

北城以北 提交于 2020-01-13 09:43:31
问题 I installed boost 1.55.0 from homebrew on macos mavericks. Getting a linker exception - not finding std::string::c_str() which I don't understand why. Could this be a problem with homebrew? I tried compiling boost 1.55.0 directly from boost and it doesn't even build on macos. This little bit of code: #include <iostream> #include <unordered_map> #include <vector> #include <boost/thread/tss.hpp> typedef std::unordered_map<std::string, std::string> StringMap; static boost::thread_specific_ptr

Linker error - Undefined symbols std::string::c_str() const on macos with libboost_thread?

一曲冷凌霜 提交于 2020-01-13 09:42:33
问题 I installed boost 1.55.0 from homebrew on macos mavericks. Getting a linker exception - not finding std::string::c_str() which I don't understand why. Could this be a problem with homebrew? I tried compiling boost 1.55.0 directly from boost and it doesn't even build on macos. This little bit of code: #include <iostream> #include <unordered_map> #include <vector> #include <boost/thread/tss.hpp> typedef std::unordered_map<std::string, std::string> StringMap; static boost::thread_specific_ptr

Unresolved symbol errors within DLL

牧云@^-^@ 提交于 2020-01-13 09:11:23
问题 For background, I have come across this porting a medium-sized linux codebase (compiling into a giant .so) to x64 windows (compiling into a .dll). I have had linker trouble. As a minimal testcase, if I create a Visual Studio project from just the following file: #include <Windows.h> #include <Dbghelp.h> void do_stuff(char const * s) { char buffer[4096]; long int len = UnDecorateSymbolName( s, buffer, sizeof(buffer), UNDNAME_COMPLETE); } And I set the project type to DLL and build it, I get an

ws2_32.lib vs. libws2_32.a, what's the difference and how to link libws2_32 to NB project?

一世执手 提交于 2020-01-13 06:58:11
问题 I use NetBeans, Windows and Cygwin with g++ compiler. I'm examining Windows Sockets 2. I do everything that is written in MS manual. I have a code (mostly from this manual): #include <winsock2.h> #include <ws2tcpip.h> #include <cstdlib> #include <iostream> #pragma comment(lib, "Ws2_32.lib") int main() { WSADATA wsaData; int iResult; // Initialize Winsock iResult = WSAStartup(MAKEWORD(2,2), &wsaData); if (iResult != 0) { printf("WSAStartup failed: %d\n", iResult); return 1; } else cout <<

How to change interpreter path and pass command line arguments to an “executable” shared library on Linux?

微笑、不失礼 提交于 2020-01-12 16:06:18
问题 Here is a minimal example for an "executable" shared library (assumed file name: mini.c ): // Interpreter path is different on some systems //+definitely different for 32-Bit machines const char my_interp[] __attribute__((section(".interp"))) = "/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"; #include <stdio.h> #include <stdlib.h> int entry() { printf("WooFoo!\n"); exit (0); } If one compiles it with e.g.: gcc -fPIC -o mini.so -shared -Wl,-e,entry mini.c . "Running" the resulting .so will look

Linking against multiple shared libraries that all linked against a common static library

末鹿安然 提交于 2020-01-12 16:06:13
问题 Say you have 2 share libraries, lib1.so and lib2.so, that both have libcommon.a statically linked into them. Would the compiler complain about ambiguous symbol reference if you were to dynamically link both lib1.so and lib2.so? Or would be the compiler be smart enough to know libcommon symbols are shared between lib1 and lib2 and allow you to dynamically link against both? 回答1: The static library would be used to resolve the links internally but the external linkage would not be propagated to

Building a Python shared object binding with cmake, which depends upon external libraries

只谈情不闲聊 提交于 2020-01-12 05:43:04
问题 We have a c file called dbookpy.c, which will provide a Python binding some C functions. Next we decided to build a proper .so with cmake, but it seems we are doing something wrong with regards to linking the external library 'libdbook' in the binding: The CMakeLists.txt is as follows: PROJECT(dbookpy) FIND_PACKAGE(PythonInterp) FIND_PACKAGE(PythonLibs) INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) INCLUDE_DIRECTORIES("/usr/local/include") LINK_DIRECTORIES(/usr/local/lib) OPTION(BUILD_SHARED

Setting my lib for LD_PRELOAD makes some processes produce loader errors

点点圈 提交于 2020-01-12 03:14:06
问题 I get the following error when I try to run a script I have only execution access for: uname: symbol lookup error: /home/dumindara/random/sotest/a.out: undefined symbol: dlsym This is after I have set LD_PRELOAD environment variable to /home/dumindara/random/sotest/a.out . a.out has a test malloc function, and calls dlsym internally. I don't get this problem when running ls . Most processes do give this error. Why does this happen and what can I do to make it work? 回答1: I assume that your a

How to prevent a globally overridden “new” operator from being linked in from external library

北城余情 提交于 2020-01-11 19:56:34
问题 In our iPhone XCode 3.2.1 project, we're linking in 2 external static C++ libraries, libBlue.a and libGreen.a. libBlue.a globally overrides the " new " operator for it's own memory management. However, when we build our project, libGreen.a winds up using libBlue's new operator, which results in a crash (presumably because libBlue.a is making assumptions about the kinds of structures being allocated). Both libBlue.a and libGreen.a are provided by 3rd parties, so we can't change any of their