header-files

Missing ';' before 'template<'

拥有回忆 提交于 2019-12-20 02:35:40
问题 I'm getting a strange error when I'm compiling my program: Error 1 error C2143: syntax error : missing ';' before ''template<'' I'm doing everything pretty standard; nothing out of the ordinary: #ifndef HEAP_H #define HEAP_H //************************************************************************** template<typename TYPE> class Heap { private: TYPE* heapData; int currSize; int capacity; void _siftUp(int); void _siftDown(int); int _leftChildOf(int) const; int _parentOf(int) const; public:

What are the rules on #include “xxx.h” Vs #include <xxx.h>? [duplicate]

試著忘記壹切 提交于 2019-12-19 22:01:30
问题 This question already has answers here : What is the difference between #include <filename> and #include “filename”? (27 answers) Closed 4 years ago . If I have my own library projects, which style should I use to #include the headers from them in my application? Are there strict rules, and do the two actually have different meanings to the compiler/preprocessor or is it about standards only? 回答1: There are few rules, according to the ISO standard. Both forms are implementation-dependent as

What Should go in my Header File in C++?

狂风中的少年 提交于 2019-12-19 19:53:48
问题 I'm just getting started on my first ever C++ program and am pretty much just learning as I go. The program is supposed to have 3 different files, a header file (prog1.h), a prog1.cpp file (not sure the right terminology for this one) and a test file that includes main: to test our program (prog1_test.cpp). Not asking for help on any of this (yet, I'm sure I'll be posting another question once I get into it), but figured you'd need to know what the program is supposed to do in order to

Where are the C headers in MacOS Mojave?

早过忘川 提交于 2019-12-19 19:52:04
问题 It seems that Apple keeps on moving their tools around and the old solution of installing the command line tools are with using xcode-select --install doesn't work. In Mojave, xcode-select doesn't install anything anymore (the GUI always fails to find the package) and the command line tools don't install itself in /usr/ or /usr/local . 回答1: xcode-select --install did work for me in Mojave. Maybe you can try installing XCode from Mac App Store, and then install developer tools? Regarding

sclite (SCTK), C++ template argument, Filter::Filter* , is invalid. Cygwin

谁说我不能喝 提交于 2019-12-19 11:29:18
问题 Problem I am currently trying to install NIST's sclite , which is part of SCTK 2.4.0 (github or newer version). I am attempting the install on Cygwin in bash . The installation is done using make . I was able to get past an issue with file [format] not recognized by doing a 64-bit compilation, as described at the end of the README and as explained in detail in another of my SO posts. Now, I again follow the installation instructions and get the following error after typing make all In file

C++ cyclic inclusion issue [duplicate]

走远了吗. 提交于 2019-12-19 09:52:48
问题 This question already has answers here : Resolve build errors due to circular dependency amongst classes (11 answers) Closed 2 years ago . I have this file logger.hpp: #ifndef _LOGGER_HPP_ #define _LOGGER_HPP_ #include "event.hpp" // Class definitions class Logger { public: /*! * Constructor */ Logger(); /*! * Destructor */ ~Logger(); /*! * My operator */ Logger& operator<<(const Event& e); private: ... }; #endif And this file event.hpp #ifndef _EVENT_HPP_ #define _EVENT_HPP_ #include <string

Does #include affect program size?

你。 提交于 2019-12-19 07:54:37
问题 When my cpp file uses #include to add some header, does my final program's size gets bigger? Header aren't considered as compilation units, but the content of the header file is added to the actual source file by the preprocessor, so will the size of the output file (either exe or dll) be affected by this? Edit: I forgot to mention that the question is not about templates/inline functions. I meant what will happen if I place an #include to a header that doesn't have any implementation detail

FLTK in MSVC needs x11 headers?

那年仲夏 提交于 2019-12-19 07:48:29
问题 I'm trying to learn how to use FLTK right now (In MSVC 2008). I got all the the libraries compiled correctly, but when I tried to run this program: #include "FL/Fl.H" #include "FL/Fl_Window.H" #include "FL/Fl_Box.H" int main(int argc, char *argv[]) { Fl_Window *window = new Fl_Window(340, 180); Fl_Box *box = new Fl_Box(20, 40, 300, 100, "Hello, World!"); box->box(FL_UP_BOX); box->labelfont(FL_BOLD + FL_ITALIC); box->labelsize(36); box->labeltype(FL_SHADOW_LABEL); window->end(); window->show()

What could cause clang to not find the unordered_map header?

霸气de小男生 提交于 2019-12-19 02:58:10
问题 I'm trying to compile a program I found on the web using Clang++. The Makefile generates this command: clang++ -c -arch x86_64 -msse3 -std=c++11 -stdlib=libstdc++ -Wno-missing-field-initializers -Wno-missing-prototypes -Wreturn-type -Wno-non-virtual-dtor -Wno-exit-time-destructors -Wformat -Wmissing-braces -Wparentheses -Wno-switch -Wunused-function -Wunused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wno-empty-body -Wuninitialized -Wunknown-pragmas -Wno-shadow -Wno-four

Is it a good idea to put all of your includes in one header file?

*爱你&永不变心* 提交于 2019-12-18 21:51:20
问题 What is the best practice for C what you put into a C header file? Is it useful to put all the includes used for a program across multiple source files in one header file? What about includes that are used in practically every file (i.e. stdio.h)? 回答1: No. It simply adds cruft and overhead. One of the biggest pains that you'll face as a maintainer is figuring out what headers don't need to be included and get rid of them. Whe you get to a list of 20+ headers, you start contemplating ugly