header-files

How to fix “unable to open stdio.h in Turbo C” error?

做~自己de王妃 提交于 2019-11-28 11:21:22
Whenever I compile my program, I get the error above. Amit If you have problems like that, first of all your TC folder put in to the C:..drive. after completing installation open turbo c blue screen. there is a OPTIONS > Directories ..in that you can see for option to set up path.. include directories..you can set path there now.. C:\TC\INCUDE libraries Directories..you can set path there... C:\TC\LIB if you want to store your output in BIN then you can set.. C:\TC\BIN ..otherwise you can set another path where you want to store your output.. Finally you can give OK and finished processes.. It

Header for scanf_s function

浪尽此生 提交于 2019-11-28 10:35:36
While answering this question I compiled the code on Ideone and got this error implicit declaration of function ‘scanf_s’ [-Wimplicit-function-declaration] Isn't stdio.h is the header for scanf_s ? scanf_s is Microsoft-specific. Header is stdio.h but not in GCC. Used to Read formatted data from the standard input stream. These versions of scanf, scanf_s, _scanf_l, wscanf, _wscanf_l have security enhancements Where as Ideone uses GCC because of this only you got undefined reference to scanf_s Mostly You can found this function in windows based compilers like Visual Studio 2008 and Microsoft

how to include header files more clearly in C++

可紊 提交于 2019-11-28 10:07:36
问题 In C++, I have some header files such as: Base.h , and some classes using Base.h : //OtherBase1.h #include "Base.h" class OtherBase1{ // something goes here }; //OtherBase2.h #include "Base.h" class OtherBase2{ // something goes here }; And in main.cpp , I can only use one of those two OtherBase classes because of duplicate header. If I want to use both classes, in OtherBase2.h I have to #include "OtherBase1.h" instead of #include "Base.h" . Sometimes, I just want to use OtherBase2.h and not

Expose only required information without including unnecessary header files

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 09:24:27
问题 I want a process to expose a structure of a message, so it can be used by other processes receiving it. However, this structure includes types of arguments which are defined in other header files, which themselves include a bunch of other header files. typedef struct sfp_info_s { int port; char platform_id[50]; sff_eeprom_t sff_type; char status_str[50]; sff_dom_t sff_dom; }sfp_info_t; sff_eeprom_t is defined in a header file named : sff_db.h and this file itself includes other files :

How do I include the string header?

浪子不回头ぞ 提交于 2019-11-28 08:06:04
I'm trying to learn about string s, but different sources tell my to include different headers. Some say to use <string.h> , but others mention "apstring.h" . I was able to do some basic stuff with apstring , but I've been told the other one is more powerful. When I include <string.h> and try to declare some string variables, however, I get errors. What is the proper usage? GManNickG You want to include <string> and use std::string : #include <string> #include <iostream> int main() { std::string s = "a string"; std::cout << s << std::endl; } But what you really need to do is get an

How to include C++ 17 headers with g++ 6.2.0 with -std=c++17 (optional, any, string_view, variant)

我与影子孤独终老i 提交于 2019-11-28 07:43:08
问题 std::optional is in C++ 17, where it was std::experimental::optional before. I tried compiling a file which included <optional> , with the command: g++ -std=c++17 <filename>.cpp (in the Bash terminal). I get the following error: <filename>.cpp:5:20 fatal error: optional: No such file or directory #include <optional> ^ compilation terminated But I can #include <experimental/optional> just fine. Am I missing some header files? How can I include the optional header? I also can't include <any> ,

Are there tools that help organizing #includes?

倾然丶 夕夏残阳落幕 提交于 2019-11-28 07:22:18
Are there any tools that help organizing the #include s that belong at the top of a .c or .h file? I was just wondering because I am reorganizing my code, moving various small function definitions/declarations from one long file into different smaller files. Now each of the smaller files needs a subset of the #include s that were at the top of the long file. It's just annoying and error-prone to figure out all #includes by hand. Often the code compiles even though not all #include s are there. Example: File A uses std::vector extensively but doesn't include vector ; but it currently includes

How to use namespace across several files

吃可爱长大的小学妹 提交于 2019-11-28 06:58:54
问题 I notice that C++'s std namespace is spread across several files (like in vector , string , iostream , etc.). How can I accomplish the same thing in my programs? Do I simply declare the same namespace in each individual header file, so that it's something like: a.h namespace something { class A {}; } b.h #include "a.h" namespace something { class B : public A {}; } And then in, say, main.cpp , I would just include "b.h" and "a.h" and then using namespace something; to use the two classes? 回答1

Where various variable and method types should be placed in a header

我与影子孤独终老i 提交于 2019-11-28 06:33:20
问题 I've noticed that I get compilation errors if I place certain declarations in certain places in my header file. I've put comments into the code as to where I think certain things go; are they correct? @interface Level : CCNode { //Instance variables? PlayBackgroundLayer* playBGLayer; PlayUILayer* playUILayer; PlayElementLayer* playElementLayer; } //Static methods? +(void) InitLevel: (int) levelNumber; +(Level*) GetCurrentLevel; //Property declarations for instance variables? @property

Defining constructor in header file vs. implementation (.cpp) file

守給你的承諾、 提交于 2019-11-28 05:20:05
I can define the body of a class constructor in the class .h file or in the implementation file .cpp . These two styles are probably identical as far as the compiler is concerned within a specific project (project for me means DLL ). Same applies to any member functions really: they can be defined in the header file or just declared there and then defined in the cpp file. However, I found that if I need to include such class header file(s) in different projects (meaning that ultimately the code that uses the header file ends up in a different DLL ) then having the actual implementation in the