Questions tagged [linker-warning]

Messages emitted by a linker which indicate potential problems in code or (more often) configuration.

Linker warnings typically flag linker issues that could potentially cause problems or unintended results, but for lack of context the linker cannot declare absolutely that the result will be flawed or undesirable.

63 questions
4
votes
4 answers

Why doesn't the g++ linker warn about this inconsistent function declaration?

This was tested on Debian squeeze with g++ 4.4 and g++ 4.7. Consider two C++ source files. ################ foo.cc ################# #include using std::string; int foo(void) { return…
Faheem Mitha
  • 6,096
  • 7
  • 48
  • 83
4
votes
2 answers

How do we disable a linker warning with a #pragma warning?

We can disable a compiler warning with #pragma warning(disable:4966) How can we disable a linker warning with a #pragma directive? Something like: // Disable linker warning LNK4221 #pragma warning(disable:4221)
Sourabh
  • 190
  • 8
4
votes
2 answers

Xcode -- Linker warning with library -- Debug-iphonesimulator vs. Debug-iphoneos

I am building a project with a library. The version I am making is the debug version. The library builds itself into the following directory: LibraryPath/build/Debug-iphoneos When I am linking my main project, I get the following warning: …
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
3
votes
1 answer

Xcode 12: how to link against object files built for free standing

The issue is about linking x86_64 macOS executables statically against libavcodec, libavdevice, etc, which have some object files built against freestanding as they use YASM which isn't able to embed the macOS "tag" in the binary (see Building for…
Jean-Michaël Celerier
  • 7,412
  • 3
  • 54
  • 75
3
votes
2 answers

Odd ld warning from rstudio

while i tried to install packages on Rstudio,I kept encountering the ld warning like this: ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file…
a972ck
  • 33
  • 4
3
votes
1 answer

ADAL iOS: Instance method in category overrides method from class (linker warning)

My setup: I'm using ADAL via cocoapods in my iOS project. Xcode: 9.2 ADAL: 2.5.4 The devastating warning of immense concern: When building I get this warning: instance method 'speInfo' in category from …
Cloud9999Strife
  • 3,102
  • 3
  • 30
  • 43
3
votes
1 answer

Linker warning "second definition ignored" when including two libraries with same function names

Context Im working on a project designed to send certain commands to a device. Each device can be interfaced with a dll (e.g. deviceADll.h, deviceBDll.h) and the Dll's were not programmed by me, nor can I modify them in any way. I am in charge of…
MDL
  • 107
  • 1
  • 10
3
votes
1 answer

Visual Studio C++ linker warning: LNK4006 with C Run-Time (CRT)

I'm going to ask this question, and then answer it myself. I'm, aware that its a newbie question, but as it took me approx. two days to find the correct answer, I'll post it anyway. So much for disclaimers - this one is dedicated to all you newbies…
bavaza
  • 10,319
  • 10
  • 64
  • 103
2
votes
1 answer

How do I treat linker warnings as errors with Clang?

I am using cmake. I tried -fatal-warnings (mentioned here) -fatal_warnings (which is mentioned with man ld) Are those supposed to be used with -W? I would like all linker warnings across the whole project to be an error. The warning I get is: ld:…
tuple_cat
  • 1,165
  • 2
  • 7
  • 22
2
votes
0 answers

C++ static member of class template -- linker warning "multiple definition"

Let's say for some reason, I want to have a class template MyTemp with some static data member smDummyVar : Mytemp.h #ifndef MY_TEMP_H #define MY_TEMP_H template class MyTemp{ ... private: static int smDummyVar; ... }; #include…
astro_son
  • 61
  • 2
2
votes
0 answers

Linker warning lnk4199

VS2010 Ultimate, Native C++, x64 DEBUG; under win7 64bit. I get this linker warning in my application: LNK4199: /DELAYLOAD:xxx.dll ignored: no imports found from xxx.dll I see in debugger that I successfully call functions from xxx.dll I give the…
Lion Butcher
  • 121
  • 1
  • 9
2
votes
1 answer

Linking a debug build to release library: Warning LNK4204

I'm using VC10 (but I guess this applies to VC9, VC10 and VC11). In short, I want to compile a release library, ship it and allow users to be able to link to that library when making a debug or release build of their application. Annoyingly I keep…
Andrew Parker
  • 1,425
  • 2
  • 20
  • 28
2
votes
2 answers

Getting rid of wchar_t size linker warning

I compile my Android NDK library with -fshort-wchar. I know the RTL assumes 4-byte wchar_t, I know what I'm doing, the library works. However, on every build linker gives me the following warning for every object file: ld.exe: warning: MyFile.o…
Seva Alekseyev
  • 59,826
  • 25
  • 160
  • 281
1
vote
0 answers

Understanding and resolving the linker warning "ld: warning: direct access in function 'Foo' to global weak symbol 'Bar'

I'm working on multiple VST3 audio plugin projects for macOS. Technically, an audio plugin is a shared library (.dylib) loaded by a host application at runtime via dlopen. I'm linking both plugins against a self-built static version of protobuf…
PluginPenguin
  • 1,576
  • 11
  • 25
1
vote
2 answers

Cannot link library for macOS-arm64 with executable for macOS-arm64

I have some trouble with creating a build system on a **Monterey M1 MacBook**: So far I have a working Makefile to build and link a library. (simplified: g++ -c all .cpp files into .o files → ar -r <.o files> libmyLibrary.a> → works great THE…