linker-warning

C++ static member of class template — linker warning “multiple definition” [duplicate]

a 夏天 提交于 2020-01-23 13:21:28
问题 This question already has answers here : Why can templates only be implemented in the header file? (16 answers) Static member initialization in a class template (3 answers) Closed 2 years ago . 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 T> class MyTemp{ ... private: static int smDummyVar; ... }; #include "MyTemp.cpp" #endif //MY_TEMP_H Mytemp.cpp ... template<class T>

C++ static member of class template — linker warning “multiple definition” [duplicate]

懵懂的女人 提交于 2020-01-23 13:21:11
问题 This question already has answers here : Why can templates only be implemented in the header file? (16 answers) Static member initialization in a class template (3 answers) Closed 2 years ago . 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 T> class MyTemp{ ... private: static int smDummyVar; ... }; #include "MyTemp.cpp" #endif //MY_TEMP_H Mytemp.cpp ... template<class T>

dlerror: Undefined symbol “_nss_cache_cycle_prevention_function” on FreeBSD 7.2

爱⌒轻易说出口 提交于 2019-12-24 09:52:57
问题 I have an ANSI C program that dynamically loads a .so file using dlopen() passing RTLD_LAZY. I receive Undefined symbol "_nss_cache_cycle_prevention_function" warnings whenever the .so file is accessed in FreeBSD 7.2. nss_cache_cycle_prevention_function() is not one of my program's functions and I imagine must be coming from FreeBSD. This might also be a problem on Linux too although I am not experiencing the issue there. I would prefer not to load FreeBSD specific header files into my

ld: warning: text-based stub file are out of sync. Falling back to library file for linking

风格不统一 提交于 2019-12-20 08:35:51
问题 When I am trying to sourceCpp , it gives a warning: ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking. But the function actually works. Just wondering how to solve this warning. 回答1: I had this problem while compiling Go code on my Mac too. The tld files were out of sync in /System/Library

How do I approach this Linux C++ warning? “can't find linker symbol for virtual table for `sockaddr_in'”

南笙酒味 提交于 2019-12-13 02:58:21
问题 Ubuntu 10.04 32-bit, eclipse, C and C++ I have a program that uses select() to monitor a bunch of TCP and UDP ports. I create those ports in the usual way (socket(), bind(), listen(), accept() etc.) using sockaddr_in structures. The program works fine at the command line. I was using the eclipse debugger to fix a bug (fixed now!) when I noticed the following warning: warning: can't find linker symbol for virtual table for `sockaddr_in' value warning: found `operator delete(void*)' instead

How do you suppress GCC linker warnings?

天涯浪子 提交于 2019-12-12 10:39:31
问题 I've been on a crusade lately to eliminate warnings from our code and have become more familiar with GCC warning flags (such as -Wall , -Wno-<warning to disable> , -fdiagnostics-show-option , etc.). However I haven't been able to figure out how to disable (or even control) linker warnings. The most common linker warning that I was getting is of the following form: ld: warning: <some symbol> has different visibility (default) in <path/to/library.a> and (hidden) in <path/to/my/class.o> The

How to Resolve Xcode Linker Warnings For Tests Target in App

假装没事ソ 提交于 2019-12-12 03:32:34
问题 The solution offered in Apple LLVM 6.0 Error: clang failed with exit code -1 may work to resolve this problem, but as I stated at the end of my problem statement is that I did not want to remove the Tests target unless that is the only solution. So, is there another solution? When trying to build a new app in Xcode, I am getting a ton of linker warnings. The warnings are related to a target that was automatically created called Tests. The expanded view of some of the warnings look like the

Linker warnings while building application against mysql-connector-c/libmysqlclient/mysql C API

喜欢而已 提交于 2019-12-08 15:50:00
问题 I am trying to build mysql-connector-c from source(per instructions here) and statically link against the library in my application. However I am getting the following warnings and I was wondering if anyone has any ideas as to why this is: /path/to/lib/libmysqlclient.a(mf_pack.c.o): In function `unpack_dirname': mf_pack.c:(.text+0x90b): warning: Using 'getpwnam' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking /path/to/lib

How to disable Linker Warnings from static libraries on xcode?

半腔热情 提交于 2019-12-07 05:53:42
问题 In my current Swift project, I have a 3rd party static library, added through the Build Phases > "Link Binary With Libraries" section. After updating to xcode 8.3, this library started throwing some linker warnings (e.g.: pointer not aligned at address 0x00000 from libraryFile.a) As pointed out by other answers (https://stackoverflow.com/a/8580123/2754958 and https://stackoverflow.com/a/6921972/2754958), the compiler warnings could be ignored by adding a flag to the library code. However, in

visual studio linker warning LNK4098

我的梦境 提交于 2019-12-07 04:26:35
问题 I have a dll project in which, when in Release configuration I build the project, I get the following warning: MSVCRT.lib(cinitexe.obj) : warning LNK4098: defaultlib 'msvcrtd.lib' conflicts with use of other libs; use /NODEFAULTLIB:library It's just a warning but I dunno if this should be taken into account. For what I've found out, they are both multithread libs, normal and debugging versions. My dll uses multithreading and I can debug it, although I use boost:thread for it, so I really