linker

"LNK1104: cannot open file 'X'": How to find out who wants X linked in?

Okay, I'm stumped. I'm fiddling with some project settings, trying to start linking against library Y instead of library X. When I search through the project file (.vcproj) and all the inherited property sheets (.vsprops), there are no references left to library X. I've closed and reopened Visual Studio to make sure it's not holding ont...

How portable is weak linking? #pragma weak my_symbol

Hi, How portable is weak linking? #pragma weak my_symbol I see that question: ow-to-make-weak-linking-work-with-gcc discusses how to get it working. But is there a good way to do this such that gcc is not required? What is the difference between weak linking and guarding the declartion with an #ifdef? #ifndef my_weak_fn void my_w...

GNU LD Script to catch C++ group / dynsym Sections

I'm maintaining a tool which can convert ELF32 relocatables to RDOFF2 format. For this process to work I need to pre-link the input files currently using the ld-script shown below: OUTPUT_FORMAT("elf32-i386", "elf32-i386", "elf32-i386") OUTPUT_ARCH(i386) FORCE_COMMON_ALLOCATION SECTIONS { .text : { /* collect .init / .f...

code breaks when trying to run any lwip function

I am trying to run the sample code for tftp server. I get no complaints when synthesizing my hardware or compiling the code. However, when I add the lwip_init() statement, it seems to stop working (it doesn't output any of the print statements). This is very frustrating and I have no idea what is causing it. Any ideas? Thanks #include <...

Mac X Framework Kernel not found

Hello, I am trying to link to the Kernel framework as a 3rd party library is using functions from the I/O Kit library (http://developer.apple.com/mac/library/documentation/Darwin/Reference/KernelIOKitFramework/index.html). I am new to development on MacX, I am on Snow Leopard and I compile with the -m32 flag. g++-4.2 -headerpad_max_in...

LLVM - linking problem

I am writing a LLVM code generator for the language Timber, the current compiler emits C-code. My problem is that I need to call C functions from the generated LLVM files, for example the compiler has a real-time garbage collector and i need to call functions to notify when new objects are allocated on the heap. I have no idea on how to ...

Troubles at Including (Linking) a static library inside another one.

Hi, I'll try to explain shortly what I want to do: A project using a static library which have another one as depandency. It produce a project called MyProject linking on MyLib1 linking on MyLib2. Here is the compile order: MyLib2 MyLib1 (linking to MyLib2) MyProject (linking to MyLib1) I'm using Visual Studio 2008 and I have some ...

Linking libraries (C++)

Using MinGW through Eclipse for C/C++, and attempting to get GLUT (OpenGL Utility Toolkit) working on it, but I suspect it's a simple problem. Attempts to build result in: g++ -LC:\Documents and Settings\C\workspace\GLUTtest\Debug -LC:\Tools\MinGW\include\GL -LC:\Tools\MinGW\include -oGLUTtest.exe main.o -lglut32.lib C:\Tools\MinGW\bi...

Link libraries compiled by various compilers

Hello, I would like to ask in more detail about a answer I recently got here (3rd one): Compiled languages basics If I write in C and MinGW and I link to C++ library compiled by VC - will it work? How do I know in advance? In other words, if I'm able to create without warnings an .exe which links to that C++ .dll, and I'm able to run ...

Possible reasons for [ILINK32 Error] Error: Unresolved external '__fastcall System::TObject::NewInstance(System::TMetaClass *)' referenced from XXX.obj?

Can you suggest what factors can cause an C++ Builder's 2009 linker error "Unresolved external '__fastcall System::TObject::NewInstance(System::TMetaClass *)' referenced from XXX.obj"? We have a set of Delphi files (pas) and set of C++ Builder files (hpp and obj), which was generated from these pas files. Set of files is copied to anot...

template class, implementation code causing linking issues

I currently have a program where my main code is in a file main.cpp. Main.cpp includes a header file "class.h" that declares a class that is used within main.cpp. Also in main.cpp I have function declarations that declare the functions I use within main.cpp. The code for these functions is in a separate .cpp file fucntions.cpp. Like ma...

How to specify adress ranges for PIC code?

I want to use Claudiu Chiculitas tiny bootloader for PIC16 (i have modyfied it to suit my chip) but since that bootloader does not move code to prevent overwriting the bootloader, I must somehow manually see to that the bootloader is not overwritten. I have tried to use the --rom option like this: --rom=default,-0-4,-3f00-3fff What I ...

Creating dummy shared object (.so) to depend on other shared objects

I'm trying to create a shared object (.so) that will make it so, by including one shared object with -lboost, I implicitly include all the boost libraries. Here's what I tried: #!/bin/sh BOOST_LIBS="-lboost_date_time-gcc43-mt -lboost_filesystem-gcc43-mt" #truncated for brevity g++ $BOOST_LIBS -shared -Wl,-soname,libboost.so.1 -o libb...

When should linkers generate multiply defined X warnings?

Never turn your back on C++. It'll getcha. I'm in the habit of writing unit tests for everything I do. As part of this I frequently define classes with names like A and B, in the .cxx of the test to exercise code, safe in the knowledge that i) because this code never becomes part of a library or is used outside of the test, name collisi...

Sun CC: where does symbol "PointZERO" come from? It's not in my source code...

This is a really weird problem. I'm compiling a C++ project on Solaris 10, with cc "Sun C 5.7 2005/01/07" and Bison 1.25 (if that matters). After finally getting the libs built, it still fails to link the executables, with following error message: Undefined first referenced symbol in fi...

Linking and file size

I'm a complete beginner, and this is how I understand linking: Static linking copies only the code that is actually used into the executable. Dynamic linking uses .dlls that may contain a lot of code that is never used by the application. Please correct me if I'm wrong :) Now here's my question. I'm using an open source library in my ap...

MySQL Connector/C++ Library Linking ERROR Problem

PROBLEM: Ok, I've been TRYING to follow the sample code on the MySQL Forge Wiki and some other websites that offer a tutorial on how to get a simple database connection, but for some reason, my project always fails at a linking error and I can't figure out why or how to fix it myself (I'm still learning). PLEASE HELP ME! I've included t...

Forcing inclusion of static library object files that don't export any symbols (GCC/iPhone)

Hi, I'm creating a static library for use in iPhone applications. It contains a number of source files which export no symbols, all they do is instantiate a static instance of a class which then runs some code in its constructor that registers various things with a central manager class elsewhere. This all works fine when the code is bu...

Static lib that links another static lib and qmake? Odd linking error

I have two qt .pro files, both using the lib TEMPLATE and staticlib CONFIG. The first library (lets call it 'core') is a dependency for the second lib (I'll call it 'foo'). In fact, there's a class in foo that extends a class in core, I will call this class Bar. When I instantiate the class (which is defined and implemented in foo, but ...

XCode linker error : library not found for -lAdMobDevice

Hey Guys, I am trying to build lite version of my iPhone application using AdMob. I followed the guidelines here http://www.iphonedevsdk.com/forum/iphone-sdk-development/11358-creating-lite-version-app.html and created two different targets. In the lite version I added a macro called LITEVERSION which I am checking using #ifdef and doin...