header-files

Tools to find included headers which are unused? [closed]

浪子不回头ぞ 提交于 2019-12-17 04:47:27
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I know PC-Lint can tell you about headers which are included but not used. Are there any other tools that can do this, preferably on linux? We have a large codebase that through the last 15 years has seen plenty of functionality move around, but rarely do the leftover #include directives get removed when

What is the significance of a .h file?

丶灬走出姿态 提交于 2019-12-14 03:41:14
问题 I know that .h file is supposed to have: class declarations, function prototypes, and extern variables (for global variables) But is there some significance of making it a .h file? I tried renaming my .h file to a .c file and it still works. We can name our file to be anything, but we choose to name it as a .h file. Am I correct? 回答1: The use of .h to name header files is just a convention. You will also see (probably on Unix-like platforms): .hpp (the Boost library uses these) .hxx (looks

C++ templates and object code instantiation

 ̄綄美尐妖づ 提交于 2019-12-13 21:28:30
问题 With this question I'd like to better understand how C++ templates system works with regards to this question. As far as I know, template-based classes and functions are usually placed into header files. This is due to the technical issue of managing generic data types, which characterstics are unknown in principle. As soon as they are known, the compiler can generate the executable code which is suited for the required data type. In the header file something.h , our class shall be defined as

Behaviour of precompiled header file causes error

帅比萌擦擦* 提交于 2019-12-13 19:19:09
问题 In below simple program, #include<conio.h> #include "stdafx.h" #include<stdio.h> int main(int argc, _TCHAR* argv[]) { printf("print"); getch(); return 0; } gives error saying 1>e:\cust\a\a\a.cpp(14) : error C3861: 'getch': identifier not found I am using VS 2005. I know that "stdafx.h" is pre-compiled header, but why we should not add any header files before it? 回答1: Precompiled headers in VS work in such a way that the precompiled header (normally named stdafx.h ) has to be the first one in

How to export multiple header files as a single header file in C++?

血红的双手。 提交于 2019-12-13 18:43:34
问题 I'm developing a DLL using Visual Studio. Currently, I have one header file: MyProject.h : #pragma once #ifdef MYLIBRARY_EXPORTS #define MYLIBRARY_API __declspec(dllexport) #else #define MYLIBRARY_API __declspec(dllimport) #endif #include <map> #include <string> extern "C" class MYLIBRARY_API Class1 { // some stuff here... }; extern "C" class MYLIBRARY_API Class2 { // some stuff here }; I am going to be adding some more classes to the project and I would like to add separate header files for

Opencv - Can't find header files

拜拜、爱过 提交于 2019-12-13 16:30:18
问题 I'm trying to start development with opencv. The problem is, until now I coul barely setup the opencv cos I cant find its header files. I made some research regarding to this subject but none of them were realy helpful, below some of the links: Where are the opencv2 include files? http://answers.opencv.org/question/14712/opencvhpp-not-in-opencv2/ I made the built the files using CMAKE GUI - Built the code with MVS 11 x64 both debug and release. The compilation suceeded and I cant found libs

What does an underscore “_” mean in Swift?

丶灬走出姿态 提交于 2019-12-13 13:26:12
问题 I just found this while browsing through the Swift module headers: protocol _ObjectiveCBridgeable { Similarly: protocol _SequenceType { Coming from an Objective-C background, this seems highly unconventional to me. The underscore _ usually implies that the concerned entity is private, and is often hidden in terms of header visibility. Why is it that in Swift they are publicly visible? Have the naming conventions changed for Swift? 回答1: It seems that the conventions have changed as far as

How to write a BitBake driver recipe which requires kernel source header files?

南笙酒味 提交于 2019-12-13 11:56:16
问题 Introduction I have a do_install task in a BitBake recipe which I've written for a driver where I execute a custom install script. The task fails because the installation script cannot find kernel source header files within <the image rootfs>/usr/src/kernel . This script runs fine on the generated OS. What's Happening Here's the relevant part of my recipe: SRC_URI += "file://${TOPDIR}/example" DEPENDS += " virtual/kernel linux-libc-headers " do_install () { ( cd ${TOPDIR}/example/Install ; .

C3646 and C4430 due to header file hierarchy?

不打扰是莪最后的温柔 提交于 2019-12-13 09:19:59
问题 I'm faced with two compilation errors: C3646 and C4430. Let me show you: I'm referring to this header file: Timer.h class Timer { } This piece of source code is working fine (in a header file): #include "Timer.h" class Something{ Timer timer_; This piece of source code is not working (in another header file): class Something_else : public Singleton<Something_else> { friend Singleton<Something_else>; Timer getDebuggerTimer; The compilation errors I get are the mentioned ones: C3646

clang on Windows - incorrect header file path

[亡魂溺海] 提交于 2019-12-13 07:42:19
问题 I built clang using VS2013 and then ran it from the command line with a -v option (clang -v testfile.c). Among the things it reported was: #include <...> search starts here: C:\Program Files (stand-alone)\LLVM\bin..\lib\clang\3.7.0\include C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include I don't understand why it is even looking at the Microsoft headers in the first place. I do not have an environment variable named INCLUDE. I verified this by doing "set INCLUDE" from the