I am currently reading "Programming Principles and Practices using C++",
I have reached a point where the code includes a "std_lib_facilities.h" header.
So I created a text file, then added all the code there and I created the header file.
But how do I include the std_lib_facilities header in my code so that it works without giving me any errors? I'm using Eclipse.
*not sure if that's what you want, that was the first link on google.
I would actually switch to code::blocks (Just sayin)... I believe that eclipse is used mostly for java? Though I do know some people who like it, generally you can find more user friendly IDEs.
#include "std lib_facilities.h"
int main()
{
cout << "Please enter your first name(followed by 'enter'):\n";
string first name;
cin >> first name;
cout << "Hello," << first_name<<"!\n";
}
And this is the error I get:
..\src\Pro.cpp:1:32: error: std lib_facilities.h: No such file or directory
..\src\Pro.cpp: In function 'int main()':
..\src\Pro.cpp:5: error: 'cout' was not declared in this scope
..\src\Pro.cpp:6: error: 'string' was not declared in this scope
..\src\Pro.cpp:6: error: expected ';' before 'first'
..\src\Pro.cpp:7: error: 'cin' was not declared in this scope
..\src\Pro.cpp:7: error: 'first' was not declared in this scope
..\src\Pro.cpp:7: error: expected ';' before 'name'
..\src\Pro.cpp:8: error: 'first_name' was not declared in this scope
+1 ultifinitus, Eclipse is prominent in the Java world. I don't think I've ever seen a company using Eclipse for C++. Why bother learning an IDE that no on uses professionally for C++?
I tried doing what you said ultifinitus but this is what came up:
..\src\Pro.cpp: In function 'int main()':
..\src\Pro.cpp:8: error: expected initializer before 'name'
..\src\Pro.cpp:9: error: 'first' was not declared in this scope
..\src\Pro.cpp:9: error: expected ';' before 'name'
..\src\Pro.cpp:10: error: 'first_name' was not declared in this scope
(edit) You can, of course use first_name, however it's against my programming method. I like to use blank_blank for functions and methods and lowerUpper for variables and UpperUpper for class names