linker

Duplicate definition for symbol __module_registered error

大兔子大兔子 提交于 2020-01-03 16:48:14
问题 I get an error message from GHCi about a "duplicate definition for symbol __module_registered", like this: GHCi runtime linker: fatal error: I found a duplicate definition for symbol __module_registered whilst processing object file /usr/local/lib/ghc-6.2/HSfgl.o How to fix this? 回答1: Thats is easy, probably indicates that when building a library for GHCi (HSfgl.o in the above example), you should use the -x option to ld. 来源: https://stackoverflow.com/questions/3392925/duplicate-definition

Every time I upgrade Xcode, I get linker errors with brew installed GCC

*爱你&永不变心* 提交于 2020-01-03 16:06:33
问题 So, I upgraded to Mavericks as well as the newest version of Xcode (5.02), and — as expected, was unable to compile any new Ruby gems which include C extensions. This happens specifically with my own project, NMatrix, which includes C and C++ code. I reinstalled the command line tools for Xcode. Then I upgraded homebrew. Then I uninstalled rbenv, ruby-build, and my custom GCC versions (except for 4.7, which was installed manually rather than through brew). Next, I used brew to install gcc48

“undefined reference” to static field template specialization

荒凉一梦 提交于 2020-01-03 16:01:39
问题 I have and header with a template class, which has only static functions and fields. template<typename T> class Luaproxy { static std::map<std::string, fieldproxy> fields; static const char * const CLASS_NAME; static void addfields(); static int __newindex(lua_State * l){ //implemented stuff, references to fields... } //etc } As you can see some of the functions are only declared, because I intend to implement them with template specialization. In a .ccp file I have: struct test { int a; }

Mixed-mode C++/CLI crashing: heap corruption in atexit (static destructor registration)

纵饮孤独 提交于 2020-01-03 15:17:24
问题 I am working on deploying a program and the codebase is a mixture of C++/CLI and C#. The C++/CLI comes in all flavors: native, mixed ( /clr ), and safe ( /clr:safe ). In my development environment I create a DLL of all the C++/CLI code and reference that from the C# code (EXE). This method works flawlessly. For my releases that I want to release a single executable (simply stating that "why not just have a DLL and EXE separate?" is not acceptable). So far I have succeeded in compiling the EXE

CMake: ordering of include directories (How to mix system- and user-based include paths?)

主宰稳场 提交于 2020-01-03 08:29:08
问题 I've got a CMake project that includes and links against two libraries, say A and B (actually it's more than two and one of them is boost stuff, but that doesn't really matter here). Both are located via FindSomething.cmake scripts that (correctly) populate the standard CMake variables such that include directories are added via INCLUDE_DIRECTORIES(${A_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${B_INCLUDE_DIRS}) and linking is later done via TARGET_LINK_LIBRARIES(mytarget ${A_LIBRARIES} ${B

Linking to wrong library version in a C++ application

戏子无情 提交于 2020-01-03 06:44:06
问题 I'm troubleshooting a C++ binary on RHEL/CentOS 5, which has problems with the openssl shared libraries. I don't do much C/C++ programming, and I'm having trouble finding the root issue. What seems to be going wrong is that the application is linking to specific versions of libcrypto and libssl (0.9.8), instead of the symlinked paths of /lib/libcrypto.so.6 and /lib/libssl.so.6 . Since the openssl libs have been updated since this was compiled, it's now broken. ldd shows the following 2

linking pgi compiled library with gcc linker

ε祈祈猫儿з 提交于 2020-01-03 05:50:06
问题 I would like to know how to link a pgc++ compiled code (blabla.a) with a main code compiled with c++ or g++ GNU compiler. For the moment linking with default gnu c++ linker gives errors like: undefined reference to `__pgio_initu' 回答1: As the previous person already pointed out, PGI supports G++ name mangling when using the pgc++ command. Judging from this output, I'm guessing that you're linking with g++ rather than pgc++. I've had the most success when using pgc++ as the linker so that it

Two functions from the same library: why does one generate undefined reference while the other doesn't?

我与影子孤独终老i 提交于 2020-01-03 05:25:11
问题 I want to replace pthread_mutex_lock by pthread_mutex_trylock in a function and when I do so, I get the "undefined reference" error message (See below). If I replace the lines 411-13 by pthread_mutex_lock(&cmd_queue_lock), I don't get the linker error. They are both from the same library which I already include. Why does one generate the linker error and the other doesn't? More importantly, how can I fix it? I tried adding "extern int pthread_mutex_trylock" and changing the order of the .o

C++: linked library disappears and gives segfault during execution

丶灬走出姿态 提交于 2020-01-03 03:25:52
问题 I'm having a problem building a library. In the Makefile I tell g++ that I need tclstub8.6 by putting -ltclstub8.6 , and g++ takes it into account (sorry for these messages in French): make: AVERTISSEMENT : le fichier « ../Linux-PORT/i586-GCC4/Makefile » a une date de modification 609 s dans le futur *** Compile c [gcc] libtestGuiMnt_info.Linux-PORT.i586-GCC4.c *** Compile C++ [g++] mntdisplay.cc *** Compile C++ [g++] mntogl.cc mntogl.cc: In member function 'virtual int MNTOgl::Display()

CMOCKA / Linker : 'wrap'ping lots of functions

我怕爱的太早我们不能终老 提交于 2020-01-03 03:06:23
问题 I recently came across the 'cmocka' mocking library for C. I was able to mock a single function and test the caller function successfully. Now i need it to use it for a project that i am working on, where it is required to mock a large number of functions. How to pass all the functions that I want to mock to the 'wrap' argument of Linker ? Is it possible to store the names of functions in a file, so that it could be picked up the linker ? 回答1: gcc -g -Wl,--wrap=something,--wrap=somethingElse