header-files

Mavericks: library not found for -lwfdb

微笑、不失礼 提交于 2019-12-10 20:23:36
问题 Moving from 10.8 to 10.9 broke my WFDB installation, library not found for -lwfdb . This program #include <wfdb/wfdb.h> int main(void) { return 0; } errors on linking (since Mavericks, -I/usr/include has to be included, otherwise the compiler errors): 567 ~/ clang -I/usr/include c.c -o c -lwfdb ld: library not found for -lwfdb I've tried also adding -L/usr/lib (where libwfdb.10.5.20.dylib , libwfdb.10.dylib and libwfdb.dylib are located), but ld still can't find -lwfdb , Seems like Mavericks

Friend Class or Friend member function - Forward declaration and Header inclusion

纵饮孤独 提交于 2019-12-10 17:55:33
问题 Yeah the question topic has been discussed so many times. And I'm almost clear about the difference. I've just one doubt related to an example in the book. This question is related to my previous question, where I presented 2 classes taken as example in the book C++ Primer. In reference to those classes, the book quotes the following paragraph, specially related to the declaration of member function of WindowManager class as friend function. Here's what it says: Making a member function a

How can I use the NumPy C-API in both C++ header and source file?

◇◆丶佛笑我妖孽 提交于 2019-12-10 17:27:42
问题 I am making Python code available to a C++ library using Boost::Python. I have a template function that converts C++ types to Python types: template <typename T> bp::object convert(T v); that is specialized for various primitive types as well as some templated classes. One such class is an N-dimensional Array, for which I have a function to convert to a NumPy Array. I'd like to use this function in a corresponding convert specialization, e.g.: template <typename Y> bp::object convert(NDArray

CMake how to include headers without sources?

筅森魡賤 提交于 2019-12-10 17:26:58
问题 This is probably a dummy question but I have literally looked at the two first pages of google without success. I'm writing a header only library and I'm unable to set up correctly the CMake configuration in order that when I build my solution a given main.cpp finds the proper includes. How can this be accomplished? EDIT So I probably should give a little more detailed explanation. Lets say I have a ./src folder with: ./src/core and ./src/wrappers . Inside each folder I have .h files that

Circular dependency in C++ headers. How To Find?

流过昼夜 提交于 2019-12-10 17:07:17
问题 I suppose you all know what is circular dependency in headers. The result of it usually are like the following: error: 'MyClass' was not declared in this scope If the program is short it is clear what to do. But if the program has tens of files... My question is "Is there some algorithm to find the circular dependency?" I mean some certain steps, which bring you to success, not just "look into the code until you found it". May be some program, which do it? 回答1: The documentation tool Doxygen

Does the standard specify what headers include other headers?

折月煮酒 提交于 2019-12-10 16:48:50
问题 I was doing a online coding contest and my idea was to find a header which has a shorter name than <iostream> but includes <iostream> . Well, I didnt suceed until now, but this made me wonder: Does the standard specify what headers include other headers? For example, on <iostream> cplusplus states: Including this header may automatically include other headers, such as <ios> , <streambuf> , <istream> , <ostream> and/or <iosfwd> . However, when I look for <ios> there is no such statement as

Is including resource.h in precompiled header a good idea?

假如想象 提交于 2019-12-10 15:43:06
问题 The VS-IDE will write //{{NO_DEPENDENCIES}} to resource header files. This comment is actually a feature that prevents (unnecessary) rebuilding of cpp files that include the resource header. But, like stated in the MSDN, this can lead to "undesirable side-effects". In our project we do have the resource.h included in the stdafx.h for pre-compilation. Unfortunately the precompiled header is not rebuild, if the resource file changes... If the NO_DEPENDENCIES is removed, it works (but it's

How to implement stdarg in C

时光总嘲笑我的痴心妄想 提交于 2019-12-10 15:05:37
问题 For curiosity, I'm looking to write minimal replacements for some of the functions in the standard C library. So far, I have finished printf() , strlen() , strcpy() , memcpy() , memset() , etc... but when I try to use the printf function, I don't know how to implement stdarg.h ! What is a way that I could do that? Does it use macros or actual functions? I am using gcc OR clang on 32-bit x86, if it helps to make this any easier to answer. 回答1: On 32-bit x86 with the cdecl calling convention,

Separate header files for concrete classes - C++

筅森魡賤 提交于 2019-12-10 14:56:50
问题 Background I have an abstract class, something like class IConverter{ public: virtual void DoConvertion() = 0; }; There will be many concrete classes which just implements DoConvertion method. class TextConverter : public IConverter{ public: virtual void DoConvertion(){ // my code goes here } }; class ImageConverter : public IConverter{ public: virtual void DoConvertion(){ // my code goes here } }; There will be many concrete implementation like this. I have created a header file say,

Have a template method but not expose implementation

僤鯓⒐⒋嵵緔 提交于 2019-12-10 13:22:51
问题 I have a function in TFRuntime.h class TFRuntime { ... template <typename T> Status computeXYSlice(Volume<T>* input, int zCoord, Volume<T> *output); ... } TFRuntime.cpp includes tensorflow library headers such as #include <tensorflow/cc/ops/standard_ops.h> #include <tensorflow/cc/saved_model/loader.h> I do not want to make these includes in the header since that would force anyone using TFRuntime to include them as well. However if i want the computeXYSlice function to allow any type, I have