linker

g++ linking issue

I have a dependancy library (libfcgi) that I compiled with g++ (GCC v4.4 MinGW) using the following calls: g++ -Iinclude -c -O2 *.c ar rcs ../libfcgi.a *.o Now, my main project is built like so: g++ -Idependancies\libfcgi\include -Ldependancies -O2 -lfcgi *.cpp g++ apparently finds libfcgi.a, but yet it fails to link to the...

Trying to statically link Boost

I am working in Linux, Eclipse CDT, g++, with Boost library. Having existing program which uses Boost thread, I try to link it statically instead of dynamically. /usr/local/lib directory contains the following files: libbost_thread.a libbost_thread.so libbost_thread.1.41.0 Dynamic linking works: g++ -o"MyProgram" ./main.o -lboost...

Static libraries and JNI

I have created a header file and a corresponding .c file full of functions I would like to use with a java program. I created a JNI header file using javah. I'm using gcc to compile my header file. How can I link my regular c object file with my JNI static library to get a static library that utilizes my C library? I'm using gcc to c...

why should the address be specified when in static linking?

background: flash at 0x02000000/2M, SDRAM at 0x10000/16M, processor: ks8695. the Bootloader and OS are burned into the flash, when resetting, OS is copied to SDRAM at address 0x10000, then set PC(program counter) to 0x10000 (that is, run the OS). since the PC is set to 0x10000(since the processor can execute the first instruction of OS...

unmanaged C program that statically links to a managed DLL: load failure

Yes, this is probably too long. Apologies in advance: This is another iteration of my previous question which was specific to remote desktop. We have an existing product consisting of many programs, which are built in (unmanaged) C. In the recent past we have started adding .NET (managed) applications to our product. A major part o...

How to prevent VC++ 9 linker from linking unnecessary global variables?

I'm playing with function-level linking in VC++. I've enabled /OPT:REF and /OPT:ICF and the linker is happy to eliminate all unused functions. Not so with variables. The following code is to demonstrate the problem only, I fully understand that actually having code structured that way is suboptimal. //A.cpp SomeType variable1; //B.cpp...

[C++/C] C++ program gets undefined reference to a dynamic C library during linking

I've created a dynamic networking library in C. When I try to link it in my C++ program I get an undefined reference the first time I call one of my functions in the library. What I can't understand is that I created a little test program in C that uses the library and it links just fine. Could someone help with my problem? Here are the...

Does splitting C++ code into multiple translation units introduce overhead on the executable size?

I have some code shared among multiple projects in a static library. Even with function-level linking I get more object code than I'd like to in the output - see another question about that. Surely the most straightforward solution to decreasing the amount of object code linked into the final executable would be to split the translatio...

Weird problem porting application. Undefined reference errors in standard libraries

Hello, I've recently been trying to port a C++ application. I believe I have all of it's dependencies and such and it all compiles. But then, when it goes to link it I get a lot of weird undefined reference errors. /usr/local/lib/libglibmm-2.4.so.7.0: undefined reference to `std::basic_istream<char, std::char_traits<char> >::seekg(long...

wxWidgets linking problem

I installed wxWidgets-2.8.10 following instructions from this page: http://wiki.wxwidgets.org/Compiling_and_getting_started Libraries directory: alex@alex-linux:/usr/local/lib$ ls | grep wx libwx_base-2.8.a libwx_base_net-2.8.a libwx_base_xml-2.8.a libwx_gtk2_adv-2.8.a libwx_gtk2_aui-2.8.a libwx_gtk2_core-2.8.a libwx_gtk2_html-2.8.a ...

Visual Studio forcing Project to be rebuilt every time.

I have a solution with Many dlls and two exe's. The exes are Dependant on the dlls when I make an internal change to any of the dlls one of my exes rebuilds and generates all its code every time. My assumption would be that it would only need to relink if no source file it depended on had changed. Could there be a setting I am missing...

What is the difference between "Local Linker Symbols" & "Local Program Variables"?

I want to know the difference between "Local Linker Symbols" & "Local Program Variables"? I'm reading a book which has this: What does each mean? Any examples? ...

xcode linking error

EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone application against my own library. To do this, I have the library project referenced from within the application. I have the header path properly set up, as compilation doesn't cause any issues. However, I'm having trouble during the linking phase and I get ...

What is "Alignment" field in binary formats? Why is it needed?

In ELF file format we have an Alignment field in Segment Header Table aka Program Header Table. In case of Windows PE file format they take it to next level the Sections have two alignment values, one within the disk file and the other in memory. The PE file header specifies both of these values. I didn't understand a thing about this...

C++: having trouble linking from command line

Just getting started with C++ here. I am working on OSX with Eclipse CDT. I have a project with some custom classes and two files "Test.hpp" and "Test.cpp" - the later with my main() method that runs some tests that I have defined and implemented in these two files. I can compile and run from Eclipse with no problems, but when I try to ...

Linking non-object file at a particular address

Hi All, Is there any option in GNU linker or linker script to load a non-object file at a particular address (i.e. the non-object file should be part of the executable image output by linker) ? Any help is appreciated. Regards, Kiran ...

Linking C and CXX files in CMake

Hi I'm building C++ app with CMake. But it uses some source files in C. Here is simplified structure: trunk/CMakeLists.txt: project(myapp) set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -g -Wall") add_subdirectory (src myapp) trunk/src/main.cpp: #include "smth/f.h" int main() { f(); } trunk/src/CMakeLists.txt: add_subdirectory (smth) lin...

Linking against multiple shared libraries that all linked against a common static library

Say you have 2 share libraries, lib1.so and lib2.so, that both have libcommon.a statically linked into them. Would the compiler complain about ambiguous symbol reference if you were to dynamically link both lib1.so and lib2.so? Or would be the compiler be smart enough to know libcommon symbols are shared between lib1 and lib2 and allow y...

Compile e text editor on Linux

Final Edit: show me how to compile e text editor on Ubuntu (32 bit Karmic) and you get the bounty ...

OpenGl Deployment: Running it on other peoples computers!

I'm kind of confused here. Im using a mac trying to develop an opengl game. The Opengl frame work is dynamically linked. So therefore i need to force static or bundle it right? Wait, wait, i read that opengl is on all macs now, yet there's extra stuff u get if u install Xcode.(i have it installed). Anyways, I want this to work on OSX, w...