linker

Building project involving cmake, how do I make it aware of libraries

情到浓时终转凉″ 提交于 2019-12-21 08:17:06
问题 When I try to build this project with cmake and gcc on a 64-bit linux (debian) machine, I get an error from the linker: Linking C executable ../../../../cpsadamsx /home/dala/lib64/libSimTKcommon.so: undefined reference to `dlopen' /home/dala/lib64/libSimTKcommon.so: undefined reference to `dlclose' /home/dala/lib64/libSimTKcommon.so: undefined reference to `dlerror' /home/dala/lib64/libSimTKcommon.so: undefined reference to `dlsym' collect2: ld returned 1 exit status make[2]: *** [cpsadamsx]

LNK1318: Unexpected PDB error; OK (0)

风流意气都作罢 提交于 2019-12-21 07:22:05
问题 I'm trying to link against a library (libcef_wrapper_dll.lib) that was built with the /MDd flag. My application is build with /MDd and /CLR so should be compatible. The project compiles fine but when linking I get the very unhelpful error below: Error 1 fatal error LNK1318: Unexpected PDB error; OK (0) '' c:\Projects\Cef\CefSharp\libcef_dll_wrapper.lib 1 CefSharp I don't have a .PDB file for the .LIB, do I need one? 回答1: Turned out that I needed to delete all of the project temp files inc.

Is there a way to detect inline function ODR violations?

我只是一个虾纸丫 提交于 2019-12-21 07:14:16
问题 So I have this code in 2 separate translation units: // a.cpp #include <stdio.h> inline int func() { return 5; } int proxy(); int main() { printf("%d", func() + proxy()); } // b.cpp inline int func() { return 6; } int proxy() { return func(); } When compiled normally the result is 10 . When compiled with -O3 (inlining on) I get 11 . I have clearly done an ODR violation for func() . It showed up when I started merging sources of different dll's into fewer dll's. I have tried: GCC 5.1 -Wodr

main.cpp:(.text+0x5f): undefined reference to

[亡魂溺海] 提交于 2019-12-21 06:21:00
问题 I try to compile some exercise from a SDL guide. I compile like this: g++ -o main main.cpp -I/usr/local/include/SDL2 -L/usr/local/lib -lSDL2 and i get this: /tmp/cci2rYNF.o: In function `main': main.cpp:(.text+0x5f): undefined reference to `Game::init(char const*, int, int, int, int, int)' collect2: error: ld returned 1 exit status and my code is: main.cpp #include "Game.h" // our Game object Game* g_game = 0; int main(int argc, char* argv[]) { g_game = new Game(); g_game->init("Chapter 1",

Is it possible to use a gcc compiled library with MSVC?

半腔热情 提交于 2019-12-21 05:29:20
问题 I have a project that relies on libiconv for several operations. I was using precompiled binaries for iconv.lib for Visual Studio 2008 but now I had to move on to Visual Studio 2010 and no more precompiled binaries were available. I decided to compile it myself but as the libiconv documentation states, there is no official support for MSVC compilers. However, I read somewhere that gcc could generate static libraries that were binary compatible with MSVC compilers, as long as the binary

How can I build an Objective-C static library to distribute as a single binary and header file?

六眼飞鱼酱① 提交于 2019-12-21 05:15:11
问题 I'm building a static library, MyLibrary , for iOS in Objective-C that bundles together a dozen useful classes, each with its own .h file. I'd like to distribute MyLibrary as a single compiled binary, libMyLibrary.a , and a single .h header file, MyLibraryAPI.h . MyLibraryAPI.h has a dozen #import statements, one for each of MyLibrary 's dozen public classes. Developers who want to include MyLibrary in their host projects should only have to include the libMyLibrary.a binary and the

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

大兔子大兔子 提交于 2019-12-21 05:08:13
问题 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 there a simple way to think of this? How do you know when to include something or how to separate things out properly. For example, what is generally a good way to

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

廉价感情. 提交于 2019-12-21 05:08:04
问题 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 there a simple way to think of this? How do you know when to include something or how to separate things out properly. For example, what is generally a good way to

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

非 Y 不嫁゛ 提交于 2019-12-21 04:51:08
问题 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 . I have written a simple destroy method like such: LudoMemory *memory_Singleton = NULL; void LudoMemory::Destroy() { LUDO_SAFE_DELETE(m_Singleton) } and upon running the program (no compiler errors) I

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

孤者浪人 提交于 2019-12-21 04:51:05
问题 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 . I have written a simple destroy method like such: LudoMemory *memory_Singleton = NULL; void LudoMemory::Destroy() { LUDO_SAFE_DELETE(m_Singleton) } and upon running the program (no compiler errors) I