linker

Link with an older version of libstdc++

After installing a new build machine, I found out it came with 6.0.10 of the standard C++ library -rw-r--r-- 1 root root 1019216 2009-01-02 12:15 libstdc++.so.6.0.10 Many of our target machines, however, still use an older version of libstdc++, for example: -rwxr-xr-x 1 root root 985888 Aug 19 21:14 libstdc++.so.6.0.8 Apparently ...

Linking using g++ fails searching for -lstdc++

I'm trying to use someone else's Makefile to complile a very simple c++ library. The makefile is as follows: JNIFLAGS=-O2 -pthread -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux all: rm -f ../dist/libUtils.so g++ $(JNIFLAGS) -c -m32 -o com_markets_utils_dates_NativeTime.o com_markets_utils_dates_Nativ...

How does linking to OS C libraries under Windows and Linux work?

I understand Linux ships with a c library, which implements the ISO C functions and system call functions, and that this library is there to be linked against when developing C. However, different c compilers do not necessarily produce linkable code (e.g. one might pad datastructures used in function arguments differently from another). ...

libc.so has four segments mapped in a process, why?

To see what memory map regions a running program contains, I write a simple C program to read data from /proc/self/maps: #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #include <unistd.h> #include <fcntl.h> int main() { char buf[1024]; int fd; ssize_t n; fd = open("/proc/self/maps", O_RDONLY); if (fd ...

Is it possible to replace the global "operator new()" everywhere?

I would like to replace the global operator new() and operator delete() (along with all of their variants) in order to do some memory management tricks. I would like all code in my application to use the custom operators (including code in my own DLLs as well as third-party DLLs). I have read things to the effect that the linker will c...

Using a .lib built with Visual Studio in Eclipse/CDT/gcc

Hello everyone I am having some trouble compiling a programm with gcc on windows which was initially developed with Visual Studio. So far I was able to resolve almost all problems like missing header files and such, but now I am stuck at one last thing: gcc fails to link to one of the third party libs my program uses (FlyCapture2.lib). ...

C++ linking error LNK2019

Can anybody please help me to configure Visual Studio 2005 (if that's the solution to the problem). I'm using some external libs and I'm getting this error: 1>Compiling... 1>main.cpp 1>c:\documents and settings\mz07\desktop\project\vs8test1\vs8test1\main.cpp(99) : warning C4996: 'getch' was declared deprecated 1> c:\program files...

IPP linker errors on cygwin

I've built a program that uses mkl and ipp that runs on mac and linux. I'm now building that program for Windows using cygwin and gcc, and can't get it to link. The errors I'm getting are: Warning: .drectve -defaultlib:"uuid.lib" ' unrecognized ../../../bin/libMath.a(VectorUtility.cxx.o):VectorUtility.cxx:(.text+0x95): undefi...

Linking C library with non-standard name

Hello, I am using gcc to compile a program which I need to link to a C library with non-standard name; it is called stuff.a instead of libstuff.a. I cannot change the name of the file (permission issues). I don't want to include the full library (i.e. using gcc program.c stuff.a -oprogram) I want to compile as gcc program.c -L/path...

Making CMake choose static linkage when possible?

I'm working on a project that's link against SOCI, which comes as both static and dynamic libraries. I'd like CMake to choose the static version when available, and dynamic otherwise. Is there a reasonable way to do this in CMake? I've come up with nothing looking through the docs so far. ...

Visual Studio linking error LNK2005 and LNK2020

Hi. I'm using visual studio 2003 and I'm getting the following linking error in my project: Linking... LINK : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification msvcrtd.lib(MSVCR71D.dll) : error LNK2005: _fprintf already defined in LIBCMTD.lib(fprintf.obj) C:\Documents and Settings\mz07\Desktop\project\H...

VC++ project never up-to-date

I'm using Visual Studio 2008. I have a solution with two projects. One builds a DLL, which is my "production code". The other builds a console app exe, which is my unit test suite. For my unit test project, I have listed as linker inputs the names of the source modules from the DLL. I.e., I have a DLLMain.cpp in the DLL project, and...

Linker errors even though I prevent them with #ifndef

I am getting linker errors that suggest I am not using #ifndef and #define. 1>TGALoader.obj : error LNK2005: "struct TGA tga" (?tga@@3UTGA@@A) already defined in main.obj 1>TGALoader.obj : error LNK2005: "struct TGAHeader tgaheader" (?tgaheader@@3UTGAHeader@@A) already defined in main.obj 1>TGALoader.obj : error LNK2005...

Linux - Is there a way to have a simple static library that contains resources?

I am trying to figure out a way of embedding a resource into a static library for linking with C source using the gcc toolchain. The equivalent of a Windows DLL in which resources are embedded. Can this be done with a linux static library? In short, would for example, doing this cat someresourcedata.txt > mylib.a and to be able to lin...

LNK2001 error when compiling windows forms application with VC++ 2008

I've been trying to write a small application which will work with mysql in C++. I am using MySQL server 5.1.41 and MySQL C++ connector 1.0.5. Everything compiles fine when i write console applications, but when i try to compile windows forms application exactly the same way (same libraries, same paths, same project properties) i get thi...

Any tool(s) for knowing the layout (segments) of running process in Windows?

I've always been curious about How exactly the process looks in memory? What are the different segments(parts) in it? How exactly will be the program (on the disk) & process (in the memory) are related? My previous question: http://stackoverflow.com/questions/1966920/more-info-on-memory-layout-of-an-executable-program-process In m...

What do C and Assembler actually compile to?

So I found out that C(++) programs actually don't compile to plain "binary" (I may have gotten some things wrong here, in that case I'm sorry :D) but to a range of things (symbol table, os-related stuff,...) but... Does assembler "compile" to pure binary? That means no extra stuff besides resources like predefined strings, etc. If C co...

How can I link (C++) with renamed Python .lib and .dll?

Hi there, When I include "Python.h" from Python 2.5 in a C++ project, it knows through some magical process that it has to link with "python25.lib" and load "python25.dll" at runtime, though I didn't specified anything neither in "Linker -> Additional Dependencies" nor in "Linker -> Additional Library Directories". Now I would like to ...

When to include .lib and when to include .dll or both

I got a .h file, two .lib files, a .dll file and a tiny test project from a hardware vendor to talk to their hardware. Compiling and running their test project works just fine. Noteworthy: they don't use the .dll. I can throw the dll-directory and all of it's content away, everything works just fine. To start things off I simply copie...

Implicit Declaration Of Function

I've just organized my code by using headers, but just as I've done this, I got a warning that turned into an error when linking. I have a code(use of a function that is inside a header) in test.c that is like this: #include "test1.h" /* Some code */ main() { Testing(); } And my test1.h header is like this: void Testing(); void ...