linker

Xcode sometimes removes linked library

天涯浪子 提交于 2019-12-30 18:57:13
问题 When using different Frameworks in Xcode, the compiler and linker sometimes do not include that Framework in the library. The result is an immediate crash during the startup with the following message: dyld: Library not loaded: /System/Library/Frameworks/UserNotifications.framework/UserNotifications Referenced from: /var/containers/Bundle/Application/1D41BD68-9B88-4D5D-B7AB-0D1C31979964/App.app/App Reason: image not found I found one way to avoid this. Its just mentioning the parts of that

Error “file not found: -fobjc-arc” on compiling IOS App in XCode

半世苍凉 提交于 2019-12-30 18:00:13
问题 after adding the OCMock framework i got that strange error... :( ld: file not found: -fobjc-arc clang: error: linker command failed with exit code 1 (use -v to see invocation) It looks like if the compiler flag tries to be loaded by XCode? Any idea? Best regards, hijolan 回答1: I was getting the exact same error on Xcode 4.3.2. Here's my navigator log; I'm adding it for Google juice. Ld /Users/makdad/Library/Developer/Xcode/DerivedData/Journal-bfkvfbsrkmrsjpddzfmwrstjfkzr/Build/Products/Debug

Are C++ class methods defined in the header always inlined?

时光总嘲笑我的痴心妄想 提交于 2019-12-30 08:17:40
问题 Edit : I've restored the original title but really what I should have asked was this: 'How do C++ linkers handle class methods which have been defined in multiple object files' Say I have a C++ class defined in a header along these lines: class Klass { int Obnoxiously_Large_Method() { //many thousands of lines of code here } } If I compile some C++ code which uses 'Obnoxiously_Large_Method' in several locations, will the resulting object file always inline the code for 'Obnoxiously_Large

What is the difference between include and link when linking to a library?

旧巷老猫 提交于 2019-12-30 06:58:09
问题 What does include and link REALLY do? What are the differences? And why do I need to specify both of them? When I write #include math.h and then write -lm to compile it, what does #include math.h and -lm do respectively? In my understanding, when linking a library, you need its .h file and its .o file. Does this suggest #include math.h means take in the .h file while -lm take in the .o file? 回答1: Its because headers files contain only declaration,and .o file (or something like that, like .obj

Why do STM32 gcc linker scripts automatically discard all input sections from these standard libraries: libc.a, libm.a, libgcc.a?

ⅰ亾dé卋堺 提交于 2019-12-30 06:50:13
问题 From the bottom of any auto-generated STM32CubeMx-generated linker script: /* Remove information from the standard libraries */ /DISCARD/ : { libc.a ( * ) libm.a ( * ) libgcc.a ( * ) } From the GNU Binutils ld (linker script) manual, 3.6.7 Output Section Discarding: The special output section name ‘/DISCARD/’ may be used to discard input sections. Any input sections which are assigned to an output section named ‘/DISCARD/’ are not included in the output file. What do these 3 input object

ld: library not found

别来无恙 提交于 2019-12-30 06:38:37
问题 I'm trying to build a project that depends on SDL2 library. I've installed and linked it using homebrew: > ls /usr/local/lib | grep SDL2 libSDL2-2.0.0.dylib libSDL2.a libSDL2.dylib libSDL2_test.a libSDL2main.a I also added /usr/local/lib to my /etc/paths and ~/.bash_profile as well: > cat /etc/paths /usr/local/lib /usr/local/bin /usr/bin /bin /usr/sbin /sbin However, when I try to build the project, I still get this error: error: linking with `cc` failed: exit code: 1 note: cc '-m64' '-L' (..

How do I force the linker to include a function I need during debugging?

故事扮演 提交于 2019-12-30 06:08:45
问题 I often make small methods to assist debugging, which aren't used in the actual program. Typically most of my classes has an AsString-method which I add to the watches. I know Delphi 2010 has visualizers, but I'm still on 2007. Consider this example: program Project1; {$APPTYPE CONSOLE} uses SysUtils; type TMyClass = class F : integer; function AsString : string; end; function TMyClass.AsString: string; begin Result := 'Test: '+IntToStr(F); end; function SomeTest(aMC : TMyClass) : boolean;

How do I force the linker to include a function I need during debugging?

不想你离开。 提交于 2019-12-30 06:07:27
问题 I often make small methods to assist debugging, which aren't used in the actual program. Typically most of my classes has an AsString-method which I add to the watches. I know Delphi 2010 has visualizers, but I'm still on 2007. Consider this example: program Project1; {$APPTYPE CONSOLE} uses SysUtils; type TMyClass = class F : integer; function AsString : string; end; function TMyClass.AsString: string; begin Result := 'Test: '+IntToStr(F); end; function SomeTest(aMC : TMyClass) : boolean;

C++ std library linking with different C++ standards

偶尔善良 提交于 2019-12-30 04:47:25
问题 I am compiling a project using Cygwin (GCC v4.5.0) and I'm having an odd linker problem. I am hoping somebody with some expertise can help. Error: undefined reference to std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&&) However, the linking only fails when I compile with the gcc compiler flag: -std=c++0x It succeeds when I don't specify the standard. Some notes: I am informing gcc to

Is there a compiler flag to indicate lack of armv7s architecture

扶醉桌前 提交于 2019-12-30 03:19:06
问题 With the iPhone 5 and other armv7s devices now appearing, there are compatibility problems with existing (closed-source) 3rd-party frameworks such as Flurry which are built without this newer architecture. One option is to wait until they release a new build, but I was hoping there might be a compiler flag or something I can use in my Xcode project that would let the linker know not to expect armv7s architecture from this framework, and use the armv7 instead. Does anything like this exist?