linker

Compiler flags in Eclipse

不想你离开。 提交于 2019-12-20 06:37:03
问题 My build requires that I issue the following commands: $ g++ sniff.cpp -o sniff -lcrafter However, in my Eclipse build, all the complier gets is: g++ -o "sniffer_crafter" ./src/sniffer_crafter.o After getting these commands it complains that I have an undefined reference to the library Crafter. How can I resolve this linking issue using Eclipse? I have seen others answers to similar questions, but they don't seem to address Eclipse's current layout. I'm using the most recent edition of

Modify g++ library path

限于喜欢 提交于 2019-12-20 05:50:35
问题 I recently installed gcc 4.9.2 and found a problem when linking with libs. The output for search path: install: /usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/ programs: =/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/libexec/gcc/x86_64-unknown-linux-gnu/:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/:/usr/lib/gcc/x86_64-unknown-linux-gnu/:/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.2/../../../../x86_64-unknown-linux-gnu/bin/x86_64-unknown

undefined reference to `dlopen'

我们两清 提交于 2019-12-20 05:15:45
问题 I have a program that does not build with modern GCC with the foollowing output: gcc -I/usr/lib/qt3/include -I/opt/kde3/include/ -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -lqt-mt -ldl -L/usr/lib/qt3/lib64 -o autocheck autocheck.cpp autocheck.cpp: In function 'int main(int, char**)': autocheck.cpp:64:62: warning: too many arguments for format autocheck.cpp:79:79: warning: too many arguments for format /tmp/ccOFReGf.o: In

missing lboost_thread-mt in mongodb cpp driver (ubuntu server x64)

只愿长相守 提交于 2019-12-20 04:30:29
问题 i have a brand new ubuntu server x64. i installed the following packages build-essential libboost-all-dev mongodb-dev mongodb-10gen now when i try to compile the example code i get this error. root@server:/home/user/Desktop# g++ mongotest.cpp -pthread -lmongoclient -lboost_thread-mt -lboost_filesystem -lboost_program_options -lboost_system -o tutorial /usr/bin/ld: cannot find -lboost_thread-mt collect2: error: ld returned 1 exit status i searched everywhere i can think of and in every way i

Manually specify remapping of specific linking symbols

旧城冷巷雨未停 提交于 2019-12-20 04:07:36
问题 Without modifying these two source files, is there a way to take the object files produced by compiling them, and convincing a linker to link foo in main_v1.c to bar in bar.c? main_v1.c void foo(void); int main(void) { foo(); } bar.c #include <stdio.h> void bar(void) { puts("bar()!"); } Modifying the object files themselves is fair game but assume that we might not even have the source code available. The platform is Linux. By insisting on a modest change to main_v1.c, and linking in an

C++ class redefinition error - Help me understand headers and linking

眉间皱痕 提交于 2019-12-20 03:17:57
问题 I started writing a simple interpreter in C++ with a class structure that I will describe below, but I quit and rewrote the thing in Java because headers were giving me a hard time. Here's the basic structure that is apparently not allowed in C++: main.cpp contains the main function and includes a header for a class we can call printer.h (whose single void method is implemented in printer.cpp ). Now imagine two other classes which are identical. Both want to call Printer::write_something(); ,

Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

浪尽此生 提交于 2019-12-20 03:09:09
问题 I am writing a C++ app for Windows using Code Blocks IDE. I am interested in using the following XML++ library: http://libxmlplusplus.sourceforge.net/ It requires libxml2 and glibmm-2.4 libraries. I downloaded the source for each of these libraries and included all of the headers into my project by right clicking on "Build Options" ==> "Search Directories" tab ==> "Compiler" tab. I specified the header include files there. I modified the main.cpp file using the source code from "examples/dom

DLL Get Symbols From Its Parent (Loader)

北城以北 提交于 2019-12-20 03:07:24
问题 I am porting a program to MS Windows. This program uses dynamically loaded plugins. The plugins reference symbols in the main program. I cannot even get the DLLs past the linker without all symbols being resolved. Is there a way to solve this? 回答1: (Sorry, I'd like to ask for clarification in a comment but I'm too much of a newbie to be allowed.) When you say the plugins "reference symbols in the main program", is it about referencing functions or data? Also, what language/compiler are you

Elegant way to set base address of ELF image with Linux binutils?

巧了我就是萌 提交于 2019-12-20 03:01:05
问题 For a personal project, I need to write an executable that loads at a non-default memory address. From this SO question, I know I can set the entry address for an ELF and modify the section addresses manually so that the executable is effectively based at some address I choose. However, the answer suggests that this is only works if I don't glibc initialization (which I need for this project), and setting section memory addresses every time I compile would be difficult (not to mention tedious

gcc/g++ parameter order

☆樱花仙子☆ 提交于 2019-12-20 02:41:37
问题 i just compiled chironfs on my new ubuntu 12.10 server and got the following error: gcc -Wall -W -Wmissing-prototypes -g -O2 -DFUSE_USE_VERSION=25 -D_FILE_OFFSET_BITS=64 -I/usr/local/include -g -O2 -lm -lfuse -o chironfs chironfs.o chiron-conf.o chirondbg.o chironfn.o chironfs.o: In function `chiron_init': /root/chironfs-1.1.1/src/chironfs.c:2000: undefined reference to `pthread_create' chironfs.o: In function `get_rights_by_name': /root/chironfs-1.1.1/src/chironfs.c:452: undefined reference