linker

Linking in several C object files that contain functions with equivalent signature

Lets say I have a C++ program and I want to call functions from a C object file in it. The constraint is that I'm not allowed to make any changes to the C source files. In this case I would include the C header as extern "C" in my C++ file, call the function, compile the C object using gcc -c, and pass the result to g++ along with the a...

How to make Xcode 3.2.3 build a specfic architecture?

I'm getting the following error when including static libraries: missing required architecture i386 in file This worked 30 seconds previously, and only failed when I upgraded to Xcode 3.2.3. I've used "file" command to check - and, yes, XCode is building completely the wrong architecture (armv6 + armv7 instead of i386). This se...

Simple filesystem operations in perl

I would like to create a new directory that its content is soft links to the the content of an existing directory, and set full permissions for this new directory. I know how to this is in bash: mkdir -m a=rwx new_dir cd new_dir ln -s /path/to/old/dir/* . but having some problems with finding the perl equivalent ...

Compiling C code for 64-bit Matlab on Intel MAC

Hi all, I need compile a piece of C code to be called from matlab (mex compiling). I am doing that on an intel mac and, since I am using Matlab's R2010a (7.10.0.499), I'd like to compile the C code into a version for 64-bits. For whatever reason, just doing mex with the -arch=maci64 option did not seem to work... As a way around, I...

Linking is jacked up.. wtf is -rpath? MacOS X

So, I'm building a project, and it uses functions from a compiled library (.dylib or .so). I have the headers and the library files (this is all part of QtRoot, btw) in appropriate locations, but when I try to build my project in Xcode, I get a debugger error: dyld: Library not loaded: @rpath/libRIO.so Referenced from: /Users/paultho...

When linking a program with gcc on Linux or OSX how can I figure out how it's called when using -l

The name of the file which contains the lib and the name used in -l do not always match. So how can I figure out the name used when linking? Usually I googled, but it should be somewhere in the system I think.. ...

iPhone Linker Error (AudioStreamer)

I'm using Matt Gallagher's Audio Streaming Project. I downloaded the code/project and it runs/compiles/links just fine. The problem is when I try to integrate the AudioStreamer class into my own project. I added all the necessary frameworks and checked over the project settings to make sure they match Matt's project as much as possibl...

Replacing ld with gold - any experience?

Has anyone tried to use gold instead of ld? gold promises to be much faster than ld, so it may help speeding up test cycles for large C++ applications, but can it be used as drop-in replacement for ld? Can gcc/g++ directly call gold.? Are there any know bugs or problems? Although gold is part of the GNU binutils since a while, I have...

g++ linker: /usr/lib/libGL.so.1: could not read symbols: Invalid operation

Hello, I'm trying to build a very simple OpenGL-app under Ubuntu 10.04 (I have a 32 bit system). When I'm trying to compile the file, I get the error message: g++ -L/usr/lib simple.cpp -lglut /usr/bin/ld: /tmp/ccoPczAo.o: undefined reference to symbol 'glEnd' /usr/bin/ld: note: 'glEnd' is defined in DSO //usr/lib/libGL.so.1 so try add...

How to link a .NET 2.0 assembly in a .NET 4.0 solution

I have a project built with .NET 4.0. I have a lot of code that would be painful to convert back to 2.0. I try to import a Dll built with .NET 2.0. Everything works until I try to execute code from that DLL. It says that it cannot load the specified module or one of its dependency I used dumpbin.exe to check what dependencies it can ha...

How to get your head around C++ linking/dependencies?

I'm a Java developer and I never have to worry about including files or messing with BUILD files. Whenever I need to write C++ code, things get more complicated. I can think of creating *.h files as interfaces in Java, but figuring out how to write the build file and what order classes should be included in gives me a headache. Is the...

Visual Studio 2008 C ++ stopping during Linking

Hi, I have written some image processing program using OpenCV 2.1 I received a error during linking, related to "projectname.ilk" file.(message said VS is trying a non-incremental linking). So I triied rebuilding the project. The initial message went away, but now VS never completes "Linking". It prints "1>Linking..." and stays that wa...

How do I add a shared library in Xcode?

Let's suppose that I enter Xcode, and select File>New Project...>Cocoa Application. I'll call this new project StupidTest. Now, once the project window opens up, I can select Build>Build and Run, and the project will build and run, creating a nice blank window. Now, lets suppose that I have a library, libStupid.so, or libStupid.dylib,...

Visual Studio Linking Problem with Cuda

I am doing some programming with nVidia's CUDA C. I am using Visual Studio 2008 as my development environment and I am having some troubles with some linking and I am wondering if someone knows a way to fix it or has had the same problem and could offer a solution. My program is made up of 3 files. 1 header file (stuff.h), 1 C source fi...

problems with global variable shared between sourcefiles (I'm using include guards)

I'm trying to share the same variable between two .cpp files, they include the same .h file. But I'm getting linking errors, telling me that I have multiple definitions. Which I find awkward, since I'm using include guards //main.cpp #include <cstdio> #include "shared.h" int main(){ shared_int = 5; printVal(); return 0; } //sh...

x86 AMD64 DLL issue - Visual Studio 2005?

Hello, I am receiving an error that says "The application was unable to start correctly (0xc000007b). Click OK to close the application." When I attempt to run a program I have compiled with Visual Studio 2005. When I run the windows program "depends" on this executable, I see a TON of DLLs which are listed as "x86" dlls. These all ap...

C++ virtual function not found

I have a class designed to do import/export of data in one of a few different formats. Each format should have exactly the same interface, so I'm implementing it as a base class with a bunch of virtual methods and a derived class for each specific format: #ifndef _IMPORTEXPORT_H_ #define _IMPORTEXPORT_H_ #include "stdio.h" enum EXPORT...

Visual Studio 2010 C++ linker performance for large projects

Hello, At my company we're still using Visual Studio 2005, but are peeking at Visual Studio 2010 in the hope that it will speed up some parts of our development cycle. At the moment we're most interested in the performance of the C++ linker of Visual Studio 2010. When building our application, we're looking at link times between 40 seco...

g++ linking issues: undefined reference to functions

I used CMake and Visual C++ to build the HyDE library. Then, still in VC++, I was able to successfully create code and build an executable that links into HyDE.lib and the HyDE header files. I then discovered that in order to work with others at my company, it would be preferable to develop in Eclipse CDT. Knowing very little about Ec...

Linking a static library into Boost Python (shared library) - Import Error

I am building a Boost Python module (.so shared library file) which depends on another external library (STXXL) While I can build and import the example Boost Python modules, I run into problems when STXXL is thrown into the mix. Specifically when running import fast_parts in python I get ImportError: ./fast_parts.so: undefined symbol...