linker

Custom C++ Static Library Not Linking (Code::Blocks)

谁说我不能喝 提交于 2020-03-04 05:59:24
问题 I've spent the past two hours researching this online, to no avail - I've followed all the instructions several times. I'm using C++11, GCC, Ubuntu 15.04, and Code::Blocks 13.12. I am creating a custom static library. At the moment, it contains only two files: iochannel.hpp and iochannel.cpp . I compile, and all is well. A single libpawlib.a file is produced in pawlib/bin/Debug Next, in the project that I want to use the static library in, I go into Project > Build Options... . I add the path

mingw32/bin/ld.exe … undefined reference to [class] … collect2.exe: error: ld returned 1 exit status

让人想犯罪 __ 提交于 2020-02-25 09:43:12
问题 Problem description while I am trying to move my code from Linux to Windows: MinGW on Windows linker problems happens when I am calling a user-defined class inside my Main.cpp ( works fine if I do not call the user-defined class constructor in Main ) Relevant code samples: Person.hpp class Person { public: Person(const string& iName, const list<string>& iContactDetails, ); virtual ~Person(); ... Main.cpp #include "Person.hpp" ... int main() { ... Person myPerson = Person (myName,

linker error while linking boost log (undefined references to boost::log::v2_mt_posix::sinks)

岁酱吖の 提交于 2020-02-24 10:10:07
问题 I’m trying to compile a program, which uses boost libraries on Ubuntu and I'm getting error: stepan@stepan-System-Product-Name:~/dev$ g++ -std=c++11 -Wall -pedantic -g -O0 -DBOOST_LOG_DYN_LINK -c test.cpp stepan@stepan-System-Product-Name:~/dev$ g++ test.o -lboost_log -lboost_thread -lpthread -lboost_system -o test test.o: In function `boost::log::v2_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >& boost::log::v2_mt_posix::basic_formatting_ostream<char,

linker error while linking boost log (undefined references to boost::log::v2_mt_posix::sinks)

被刻印的时光 ゝ 提交于 2020-02-24 10:06:28
问题 I’m trying to compile a program, which uses boost libraries on Ubuntu and I'm getting error: stepan@stepan-System-Product-Name:~/dev$ g++ -std=c++11 -Wall -pedantic -g -O0 -DBOOST_LOG_DYN_LINK -c test.cpp stepan@stepan-System-Product-Name:~/dev$ g++ test.o -lboost_log -lboost_thread -lpthread -lboost_system -o test test.o: In function `boost::log::v2_mt_posix::basic_formatting_ostream<char, std::char_traits<char>, std::allocator<char> >& boost::log::v2_mt_posix::basic_formatting_ostream<char,

The initialization part is not called

≡放荡痞女 提交于 2020-02-23 10:29:32
问题 I'm maintaining the VirtualTreeView component for Delphi and C++Builder. With Delphi everything is okay but when I compile the packages with the C++Builder the code in the initialization part in the Delphi units is not called. Any ideas? 回答1: When a Delphi unit's initialization / finalization sections are not being called in a C++Builder project, it usually means the Delphi unit is not being linked into the final executable, typically because the C++ code is not directly referencing any code

How to link to an xxx.dll when the provider only ships it with an xxx.lib and you are using MinGW-w64 and not MSVC?

こ雲淡風輕ζ 提交于 2020-02-23 07:50:29
问题 Firebird and Boost communities only provide the xxx.lib for their pre-built xxx.dll binaries, and I am using MinGW-w64 v7.0.0 with GCC v8.1.0 , and this last one expects a libxxx.a file containing all the xxx.dll function symbols to link with. For Boost , I can build it from the source code for MinGW-w64 (though I still prefer using the pre-built ones, because the build process for big toolkits like this one takes forever). As for Firebird , it is not buildable using MinGW-w64 at all, except

Why are there global offset tables and procedure linkage tables in statically linked executables?

早过忘川 提交于 2020-02-20 09:47:42
问题 I've done a bunch of reading on dynamic linker relocations and position independent code including procedure linkage tables and global offset tables. I don't understand why a statically linked executable needs a PLT and GOT. I compiled a hello world program on my ubuntu x86_64 machine and when I dump the section headers with readelf -S it shows PLT and GOT sections. I also created a shared library with a simple increment function that I compiled with gcc -shared without -fpic and I also see

Missing a library in ldd after using gcc -l

不羁岁月 提交于 2020-02-20 07:13:06
问题 I'm compiling an executable called "interrogate" with: g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \ built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \ -lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub -pthread -ldl After the compilation, when i try to execute the executable: $ LD_LIBRARY_PATH=built/lib built/bin/interrogate built/bin/interrogate: symbol lookup error: built/lib/libp3dtool.so.1.8: undefined symbol: _Py_NoneStruct This symbol is

Missing a library in ldd after using gcc -l

风流意气都作罢 提交于 2020-02-20 07:12:22
问题 I'm compiling an executable called "interrogate" with: g++ -o built/bin/interrogate -Lbuilt/lib -Lbuilt/tmp -L/usr/X11R6/lib \ built/tmp/interrogate_composite1.o built/tmp/interrogate_composite2.o \ -lp3cppParser -lp3dtool -lp3dtoolconfig -lp3pystub -pthread -ldl After the compilation, when i try to execute the executable: $ LD_LIBRARY_PATH=built/lib built/bin/interrogate built/bin/interrogate: symbol lookup error: built/lib/libp3dtool.so.1.8: undefined symbol: _Py_NoneStruct This symbol is

C++ linker error in Apache Thrift tutorial - undefined symbols

▼魔方 西西 提交于 2020-02-15 18:02:04
问题 I am running through Apache's Thrift tutorial: http://wiki.apache.org/thrift/ThriftUsageC%2B%2B My Thrift is version 0.9.1, and I'm on OS X. I've performed a search for similar problems with this tutorial, and while other people have also had issues they don't appear to be similar to the one I'm having. The server both compiles and links properly, and the client compiles correctly as well. The problem is linking the client at the very last step of the tutorial, where I get this: Undefined