linker

Linker error: already defined

瘦欲@ 提交于 2019-12-22 10:19:04
问题 I am trying to compile my Visual C++ project (uses MFC) in Microsoft Visual Studio 2012, and it comes back with the following errors: error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj) error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj) error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj) error LNK1169: one or

Targeting multiple platforms in iPhone SDK 4

。_饼干妹妹 提交于 2019-12-22 10:07:21
问题 I have an iPhone SDK project that is supposed to build a static library for both the simulator and the ARM processor and then combine the two into a universal library. Heretofore, I was using iPhone SDK 3+ and accomplished this by creating a separate target for each, one simulator and one ARM, and then making a third target that combines them using a shell script. The deployment targets/build settings for each of the constituent targets are set to their respective architectures, etc. Also,

cpp file with a single global variable is ignored

青春壹個敷衍的年華 提交于 2019-12-22 09:56:27
问题 I'm trying to initialize a global map std::map<long, std::string> Global_ID_Mapper; with a number of "init" classes like: struct AGlobalMapperInitializer { AGlobalMapperInitializer() { Global_ID_Mapper.insert( std::make_pair(1, "Value1") ); Global_ID_Mapper.insert( std::make_pair(2, "Value2") ); } }; I want to fill the map automatically during application start. So in one of my cpp files, I just define a global variable of that "init" class. // AGlobalMapperInitializer.cpp

Linking failure with a MonoTouch native library binding

纵然是瞬间 提交于 2019-12-22 09:54:54
问题 I am creating native library binding for the Wikitude SDK. The MonoTouch app fails linking : Undefined symbols for architecture armv7: "std::__1::basic_string, std::__1::allocator >::find_last_of(char const*, unsigned long, unsigned long) const", referenced from: WtUnzip::unzipFileTo(char const*, bool)in WikitudeSDK.a(wtunzip.o) ... My LinkWith: [assembly: LinkWith ("WikitudeSDK.a", LinkTarget.ArmV7, Frameworks = "CoreVideo Security SystemConfiguration CoreMedia AVFoundation CFNetwork

How do I resolve linker warning “ignoring linker optimzation hint at” in XCode?

本小妞迷上赌 提交于 2019-12-22 09:01:09
问题 A google search for "ignoring linker optimzation hint" practically turns up nothing. NOTE: "optimzation" is the exact spelling :) I'm using a 3rd party WebRTC library (libjingle_peerconnection) from Pristine in one of my apps and I get warnings when I build for my iPhone 6. I'm not sure if this warning will pop up for other devices, however, it does not appear when I build for the simulator. I have exactly 68 of these bad boys in my build output: ld: warning: ignoring linker optimzation hint

Unable to link to libgfortran.a [duplicate]

感情迁移 提交于 2019-12-22 08:35:08
问题 This question already has answers here : Why does the order in which libraries are linked sometimes cause errors in GCC? (9 answers) Closed 5 years ago . I have gfortran installed on my system and the file libgfortran.a can be found at /usr/lib/gcc/x86_64-linux-gnu/4.6/ . Using nm I made sure that the function _gfortran_compare_string is defined in there: $ nm /usr/lib/gcc/x86_64-linux-gnu/4.6/libgfortran.a | grep _gfortran_compare_string Returns 0000000000000000 T _gfortran_compare_string

Loading shared libraries with dependencies on Android

自闭症网瘾萝莉.ら 提交于 2019-12-22 08:15:39
问题 I'm porting a big chunk of native code with several interdependent libraries. Loading the code fails since Android linker only looks dependencies in /system/lib/ and not in the application install directory at /data/data/com.packagename.nnn/lib . As a first workaround I loaded all .so's from Java with System.load() in correct dependency order . This solution isn't satisfactory for me mostly because the set of libraries changes from build to build due to plugin architecture. Also the UI

Analyzing an ELF binary to minimize its size

对着背影说爱祢 提交于 2019-12-22 07:44:46
问题 I'm cross-compiling a V8 project to an embedded ARM target using the GCC arm-gnueabi cross compiler. I got the V8 library itself cross-compiled successfully, and as a smoke test I wanted to link it to Google's hello world example and run it on the ARM board. The libraries themselves clock in at a bit over 1.2 MB: v8 % find out/arm.release/obj.target/ -name '*.a' -exec du -h {} + 1.2M out/arm.release/obj.target/tools/gyp/libv8_base.a 12K out/arm.release/obj.target/tools/gyp/libv8_libbase.a 4

STM32 gcc (arm-none-eabi-gcc) links printf even though it is not used

徘徊边缘 提交于 2019-12-22 06:50:00
问题 I can't seem to figure out why some printf library functions get linked into my code from libc_nano.a even though I never use any printf . It steals at least 2K of valuable flash memory space. I can see the sections _printf_i , _vfprintf_r , _vfiprintf_r , etc. in my linker map file. I tried Wl,--exclude-libs option EXCLUDE_FILE(..) in linker script None of these make the symbols disappear from the map file.. My gcc options: CFLAGS = -Og -Wall -g3 -Wdouble-promotion -mcpu=cortex-m0 -mthumb

When linking, is there something between “grab what you need” and “grab all” (-Wl,--whole-archive)?

南笙酒味 提交于 2019-12-22 06:48:29
问题 I have this library which involves some static initialization code which needs to run before main() . It all works well if you just compile all of the translation units together, but it doesn't work if I provide a static library ( .a file) and have users link their application against it - the linker simply ignores the symbols which do my static initialization. Alternatively, I can make the linker pick up everything in the static library, if I specify the -Wl,--whole-archive option to GCC, i