32-bit absolute addresses no longer allowed in x86-64 Linux?

Your distro configured gcc with –enable-default-pie, so it’s making position-independent executables by default, (allowing for ASLR of the executable as well as libraries). Most distros are doing that, these days. You actually are making a shared object: PIE executables are sort of a hack using a shared object with an entry-point. The dynamic linker already …

Read more

Unable to link GoogleAnalytics 3.01 with XCode 5 (missing required architecture x86_64)

You’re not doing anything wrong. I’m pretty sure google has not yet provided a arm64 version of their libGoogleAnalyticsServices.a, which is really annoying …it has been weeks since the public the release of Xcode 5GM. For now, I guess only build for armv7, armv7s or remove google analytics until they get their head out of …

Read more

How to link C++ object files with ld

If you run g++ with the -v flag, you’ll see the link line it uses. Here’s a simple example program: #include <iostream> int main(void) { std::cout << “Hello, world!” << std::endl; return 0; } And the output from running g++ -v -o example example.cpp: Using built-in specs. Target: x86_64-linux-gnu Configured with: ../src/configure -v –with-pkgversion=’Ubuntu/Linaro 4.4.4-14ubuntu5.1′ …

Read more

Error when compiling some simple c++ code

Normally this sort of failure happens when compiling your C++ code by invoking the C front-end. The gcc you execute understands and compiles the file as C++, but doesn’t link it with the C++ libraries. Example: $ gcc example.cpp Undefined symbols for architecture x86_64: “std::cout”, referenced from: _main in ccLTUBHJ.o “std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> …

Read more

Undefined symbols “vtable for …” and “typeinfo for…”?

If Obstacle is an abstract base class, then make sure you declare all its virtual methods “pure virtual”: virtual void Method() = 0; The = 0 tells the compiler that this method must be overridden by a derived class, and might not have its own implementation. If the class contains any non-pure virtual functions, then …

Read more