linker

Linker error LNK2038: mismatch detected in Release mode

≯℡__Kan透↙ 提交于 2019-12-20 10:17:43
问题 I am trying to port a small app of mine from Win XP and VS 2005 to Win 7 and VS 2010. The app compiles and runs smoothly in Debug mode, however in Release mode I get the following error: pcrecpp.lib(pcrecpp.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in LoginDlg.obj Where should I start checking? 回答1: Your app is being compiled in release mode, but you're linking against the debug version of PCRE, which had /MTd (or similar) set, thus

Call a C++ function from Swift

雨燕双飞 提交于 2019-12-20 10:04:45
问题 How should I call a C++ function (no classes involved) from a Swift file? I tried this: In someCFunction.c : void someCFunction() { printf("Inside the C function\n"); } void aWrapper() { someCplusplusFunction(); } In someCpluplusfunction.cpp : void someCplusplusFunction() { printf("Inside the C++ function"); } In main.swift : someCFunction(); aWrapper(); In Bridging-Header.h : #import "someCFunction.h" #import "someCplusplusFunction.h" I found this answer very informative, but still I cannot

Android NDK/JNI: Building a shared library that depends on other shared libraries

雨燕双飞 提交于 2019-12-20 09:37:32
问题 I am writing an android app that wants to make JNI calls into a shared library built in using the NDK. The trick is this shared library calls functions provided by OTHER shared libraries. The other shared libraries are C libraries that have been compiled elsewhere. Here's what I've tried: My Environment: I'm working in Eclipse. I've added native support and have a jni library. In that library I have my code and a \lib directory where I have copied my other .so files. Attempt #1 Android.mk:

How do I determine the fastest link order?

柔情痞子 提交于 2019-12-20 09:27:46
问题 I have about 50 different static libraries being linked into my c++ project and the linking takes on average 70s. I've found that moving around with the link order of the libraries changes this time. This is expected I guess if the linker doesn't have to keep searching for a set of symbols throughout the entire symbol table it has built upto that point. I suppose I could use "nm" to get a dependency graph between the static libraries. However, that would only give me one "correct" link order.

What's the difference between `-rpath-link` and `-L`?

余生颓废 提交于 2019-12-20 09:20:32
问题 The man for gold states: -L DIR, --library-path DIR Add directory to search path --rpath-link DIR Add DIR to link time shared library search path The man for bfd ld makes it sort of sound like -rpath-link is used for recursively included sos. ld.lld doesn't even list it as an argument. Could somebody clarify this situation for me? 回答1: Here is a demo, for GNU ld , of the difference between -L and -rpath-link - and for good measure, the difference between -rpath-link and -rpath . foo.c

Any difference between “-Wl,option” and “-Xlinker option” syntax for gcc

和自甴很熟 提交于 2019-12-20 09:11:50
问题 I have been looking through some configuration files and I've seen both being used (albeit on different architectures). If you're using gcc on a linux box is there any difference between the two syntax for passing options to the linker? Reading the gcc manual they are explained almost identical as far as I could tell. 回答1: I don't really know what else to do than look up man gcc , which you should keep in mind for future questions pertaining to gcc invocation. So: -Xlinker option Pass option

ldconfig error: is not a symbolic link

大城市里の小女人 提交于 2019-12-20 08:56:29
问题 When running: sudo /sbin/ldconfig the following error appears: /sbin/ldconfig: /usr/local/lib/ is not a symbolic link When I run file: file /usr/local/lib/ /usr/local/lib/: directory Inside /usr/local/lib/ there are three libraries that I use. I'll call them here as lib1 , lib2 and lib3 . Now, when I do an ldd on my binary it results: lib1.so => not found lib2.so => not found lib3.so => /usr/local/lib/lib3.so (0x00216000) But all of then are in the same folder as /usr/local/lib/{lib1,lib2

Xcode : warning: directory not found for option [duplicate]

六眼飞鱼酱① 提交于 2019-12-20 08:56:20
问题 This question already has answers here : ‘ld: warning: directory not found for option’ (26 answers) Closed 6 years ago . Ld /Users/pwang/Library/Developer/Xcode/DerivedData/socketiohldwxnslzhlnjtgihgewdwavpjpb/Build/Products/Debug-iphoneos/socketio.app/socketio normal armv7 cd /Users/pwang/Desktop/saturngod-Socket.io-with-iOS-be51414 setenv IPHONEOS_DEPLOYMENT_TARGET 4.3 setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode

When to use the Visual Studio Additional dependencies?

 ̄綄美尐妖づ 提交于 2019-12-20 08:26:43
问题 In C++, you got the header files (.h), the (.lib) files and the (.dll) files. In Visual Studio, you provide the location to search for these files in three different places: Configuration Properties => C/C++ => General => Additional Include directories. Here you list out the "include" directories that you want searched and made available. Configuration Properties => Linker => General => Additional Library directories. Here you list out the "lib" directories that you want to be searched and

Building Boost for static linking (MinGW)

一曲冷凌霜 提交于 2019-12-20 08:02:00
问题 I'm building Boost (I'm using System and FileSystem) for MinGW using bjam: bjam --toolset=gcc stage And it builds fine, but I want to be able to statically link to it (I have to have a single file for the final product) so I tried: bjam --link=static --toolset=gcc stage But I get the same output. Any ideas? edit second question in a row I've answered moments after posting :p guess I'll leave this up here for others though. bjam --build-type=complete --toolset=gcc stage Will build both dynamic