Resolving circular dependencies by linking the same library twice?

The problem with g++ -o myApp -lfoo -lbar -lfoo is that there is no guarantee, that two passes over libfoo and one pass over libbar are enough. The approach with Wl,–start-group … -Wl,–end-group is better, because more robust. Consider the following scenario (all symbols are in different object-files): myApp needs symbol fooA defined in libfoo. …

Read more

What’s the difference between gtest.lib and gtest_main.lib?

the only reasonable difference is that gtest_main.lib provides a default implementation of a test application entry point (i.e. main function): Citation from Getting started with Google C++ Testing Framework: “[…] maybe you think that writing all those main() functions is too much work? We agree with you completely and that’s why Google Test provides a …

Read more

Is a statically linked executable faster than a dynamically linked executable?

Static linking produces a larger executable file than dynamic linking because it has to compile all of the library code directly into the executable. The benefit is a reduction in overhead from no longer having to call functions from a library, and anywhere from somewhat to noticeably faster load times. A dynamically linked executable will …

Read more

library is linked but reference is undefined

when you are linking, the order of your libraries and source files makes a difference. for example for your case, g++ -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL opencl.cpp functions defined in the OpenCL library might not be loaded, since there nothing before them asking for a look-up. however if you use, g++ opencl.cpp -I/usr/local/cuda/include -L/usr/lib/nvidia-current -lOpenCL then any …

Read more

How to use OpenSSL with Visual Studio [closed]

I know it’s old! I faced the problem myself and here’s the solution. First of all, you should install (normal ordinary installation) openssl. (It’s from here). Now, after you create a project, I quote: Make sure the following settings are setup in the project property pages: [C/C++ -> General -> Additional Include Directories] value: OpenSSL’s …

Read more