Все вопросы: [linker]

432 вопросов

29
голосов
3ответов
17259 просмотров

Linking a shared library against a static library: must the static library be compiled differently than if an application were linking it?

At least on Linux and Solaris, static libraries are really just a bunch of compiled .o's tossed into one big file. When compiling a static library, usually the -fpic flag is ommited, so the generated code is position dependent. Now say my static library is B. I've built it and have the resultin...

7
голосов
2ответов
7104 просмотров

Building Visual C++ app that doesn't use CRT functions still references some

This is part of a series of at least two closely related, but distinct questions. I hope I'm doing the right thing by asking them separately. I'm trying to get my Visual C++ 2008 app to work without the C Runtime Library. It's a Win32 GUI app without MFC or other fancy stuff, just plain Windows ...

0
голосов
1ответов
2756 просмотров

Why does compiling a shared object with GCC always result in undefined references to main?

I'm running Solaris, so it's possible that this is specific to running GCC on Solaris. If I use GCC to generate a shared object, and then run nm on it to see undefined symbols, there will always be a reference to main: [624] | 0| 0|NOTY |GLOB |0 |UNDEF |main If I manually...

6
голосов
3ответов
22246 просмотров

The procedure entry point could not be located in the dynamic link library Core.dll

I am converting my project to use DLLs and am trying to break apart my Singleton class to avoid using templates. My class, LudoMemory, originally inherited from Singleton. I am trying to give it the functions to destroy and create itself now and have my main engine not rely on the Singleton. ...

1
голосов
2ответов
507 просмотров

Exporting template code = dangerous? (MSVC)

As I noted in another SO question, I came across this article. The issue came up when I compiled boost 1.40 via MSVC7.1 and several C4251 warnings popped up. Now, after reading said article, I wonder: Is it generally discouraged to export template code, e.g. class DLLEXPORT_MACRO AClass { publi...

1
голосов
2ответов
778 просмотров

Including header file with global variable

I need to include a header file that contains some global variables (not mine so I cannot change it). How do I do this so that the variables within the included file are considered 'extern' in all but one case?

43
голосов
6ответов
58215 просмотров

LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:ICF' specification

I recently converted a multi-project Visual Studio solution to use .dlls instead of .libs for each of the projects. However, I now get a linker warning for each project as stated in the example. MSDN didn't serve to be all that helpful with this. Why is this and how can I solve it? Warning...

2
голосов
1ответов
3083 просмотров

Warning linking boost lib in WDK build ("LNK4217: locally defined symbol _ imported in function _")

I'm building the below example boost-consuming user-mode app with the WDK, but I'm getting the following errors when linking with the boost libraries that I built earlier using bootstrap and .\bjam, from the same terminal window. IIUC, MSDN says it's because the (hideously mangled) function - wh...

4
голосов
2ответов
10886 просмотров

How to make gcc or ld report undefined symbols but not fail?

If you compile a shared library with GCC and pass the "-z defs" flag (which I think just gets passed blindly on to ld) then you get a nice report of what symbols are not defined, and ld fails (no .so file is created). On the other hand, if you don't specify "-z defs" or explicitly specify "-z nod...

1
голосов
2ответов
4742 просмотров

Under what conditions will you get unresolved external symbol for __declspec(dllimport)?

I am converting an application to use .dlls and I'm riddled with linker errors stating unersolved external symbol"__declspec(dllimport) public: void __thiscall Rail::SetNextrail(class Rail *)" There is more gibberish at the end of this error message. Why should this happen and how d...

5
голосов
4ответов
2556 просмотров

'operator new': redefinition, different linkage (using _dllspec on redefined new operator)

I am using __declspec(dllimport/export) on a debug version of new as such: #ifdef _DEBUG DECLSPECCORE extern void* operator new(unsigned int size, const char* file, int line); extern void* operator new[](unsigned int size, const char* file, int line); extern void operator delete(void* addre...

1
голосов
2ответов
9465 просмотров

ld cannot find library that is installed

I'm sitting on an OpenSuse 11.1 x64 Box and I have a module that uses sigc++. When linking like this: g++ [a lot of o's, L's and l's] -lsigc-2.0 I get /usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: cannot find -lsigc-2.0 However the library is there. In the files...

0
голосов
4ответов
1716 просмотров

LNK2019 when converting an app to use DLLs

(Re-written for clarity) I have a multi-project solution that I am looking to convert from using .lib to .DLL files. I have created my __declspec macros and applied it to every class except for those in the project that creates the final .exe. The linker is throwing a fit on just about everyth...

0
голосов
3ответов
3496 просмотров

Object code, linking time in C language

When compiling, C produces object code before linking time. I wonder if object code is in the form of binary yet? If so, what happened next in the linking time?

1
голосов
2ответов
192 просмотров

iPhone app switching

Is it possible to run an iPhone app from your own app? For example when you press a button in your app, the iPhone switches to another app. If so, how would you do this?

8
голосов
2ответов
7410 просмотров

tcmalloc: how can I get my malloc calls overridden when compiling statically?

When I use LD_PRELOAD=/usr/local/lib/libtcmalloc.so, all my calls to malloc become tcmalloc calls. However, when I link statically against libtcmalloc, I find that straight malloc is getting called unless I still use the LD_PRELOAD setting. So how can I statically compile against tcmalloc in su...

3
голосов
3ответов
761 просмотров

LNK2019 && LNK1120 errors when splitting my code in multiple files

My code is stored in a main.cpp file which contains the void main() function, and a class MyClass which I now want to split to another file. IDE is Microsoft Visual Studio 2008 Professional. myclass.h #include <tchar.h> class MyClass { public: static bool MyFunction (TCHAR* someString...

1
голосов
2ответов
1763 просмотров

Undefined symbol _main when trying to build logstalgia on mac

I have been trying to build the logstalgia project (http://code.google.com/p/logstalgia/) on my Mac (10.5). Rather than having to link it to the system libraries correctly, I have built and added all of the dependencies to the project. I am new at this, but I do think I have done this correctly, ...

5
голосов
1ответов
4165 просмотров

AIX 5.3 (ld-xlc) equivalent option Linux (ld-gcc) -rpath

My compiler:xlc version 10.1 Environment: AIX5.3 Linker: ld When i work on Linux , with gcc (4.4.1) i use the following option -Wl,-rpath (-Wl for the linker options) it adds a directory to the runtime library search path. What's the equivalent for xlc compiler ? or what's the equivalent ...

6
голосов
3ответов
3001 просмотров

linux/gcc: ldd functionality from inside a C/C++ program

Is there a simple and efficient way to know that a given dynamically linked ELF is missing a required .so for it to run, all from the inside of a C/C++ program? I need a program with somewhat similar functionality as ldd, without trying to execute the ELF to find out the (met/unmet) dependencies...

0
голосов
1ответов
2240 просмотров

Symbols not found error when linking iPhone app in Xcode

Whenever I try to compile my iPhone app which i am porting I get linking errors. The app uses a scripting language called Squirrel (to read the level files, fine by the SDK, no user input). I have linked all the libraries including libsquirrel.a. What am I doing wrong? (App is SuperTux, source co...

1
голосов
3ответов
1962 просмотров

Can a DLL link to another DLL with an import library if the first DLL is linked at runtime?

I'm writing a DLL for an audio-player (foobar2000) using its SDK. My DLL links to another DLL, and I've done so using an import library (.lib). However, at run-time, the audio player complains that my DLL (the one that links to the other) is missing a dependency. I don't know if this can be gen...

11
голосов
2ответов
12587 просмотров

Why is curses on linux giving me following error?

Trying to get getch() working to capture key press. #include <curses.h> ... ... WINDOW *w; char f; w = initscr(); timeout(3000); f = getch(); endwin(); is giving me following error:- undefined reference to `wgetch' undefined reference to `stdscr'

3
голосов
2ответов
2446 просмотров

Link error CString

I'm getting a linker error using CString the error is: error LNK2001: unresolved external symbol "private: static class ATL::CStringT<wchar_t,class StrTraitMFC<wchar_t,class ATL::ChTraitsCRT<wchar_t> > > CConfiguration::_campaignFolderPath" ([email protected]@...

3
голосов
2ответов
1999 просмотров

Can I see what is eliminated by the Visual C++ /OPT:REF linker option?

The /OPT:REF option causes the Visual C++ linker to Exclude functions and/or data that are never referenced (MSDN) This seems like it would be a good way to identify obsolete code in a legacy codebase. Is there any way to get the linker to output what is eliminated?

0
голосов
3ответов
146 просмотров

Function declarations and an unresolved external

I am looking after a huge old C program and converting it to C++ (which I'm new to). There are a great many complicated preprocessor hacks going on connected to the fact that the program must run on many different platforms in many different configurations. In one file (call it file1.c) I am ca...

4
голосов
1ответов
2949 просмотров

Undefined symbol _main when trying to build shared library g++ / mac

I am trying to build libdecodeqr on a mac. My c++ building and linking history is all on windows, so it's an exciting journey of discovery. I have finally got to the point where I want to create the linked library. The command I am running is: g++ -shared -o libdecodeqr.so.0.9.3 bitstream.o c...

1
голосов
2ответов
61 просмотров

how modules can linked

In my dotnetnuke application i added so many modules, i want to display the content in the contentpane when i clicked on the items that is in in the left / right pane. Can you give me the code for navigating the modules..

7
голосов
3ответов
7374 просмотров

Statically linking a DLL in Windows

Consider this situation: I'm creating a DLL (let's call this dllA), which, in turn, calls functions in other DLLs (let's call these dllX, dllY and dllZ). If someone else wanted to use dllA, they'd need a copy of dllX, Y and Z as well. Is there a way to build dllA such that the needed functions...

39
голосов
4ответов
24391 просмотров

Hierarchical ldd(1)

Due to using Gentoo, it often happens that after an update programs are linked against old versions of libraries. Normally, revdep-rebuild helps resolving that, but this time it's a dependency on a python library, and python-updater won't pick it up. Is there a "hierarchical" variant of ldd whic...