Hello World

Hello,

I just started reading this book: Programming_Principles_and_Practice_Using_C_Plus_Plus_Bjarne_Stroustrup. I got stuck during the first drill.

Could you guys help me out with these unclear errors? I've tried everything I could to fix them but instead I got a headache.

These are the first two errors I receive (out of 100):

1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\math.h(62): error C3861: 'floor': identifier not found
1>c:\program files (x86)\microsoft visual studio 14.0\vc\include\cmath(37): error C2039: 'fabs': is not a member of '`global namespace''

And this is the code. Note that initially I used the '#include std_lib_facilities.h' as mentioned in the book but I've got the same errors.

Thanks!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;
inline void keep_window_open() { char ch; cin>>ch }
int main()
{
	cout << "Hello, World!\n";
	keep_window_open();
	return 0;
}
That sounds like something wrong with the VS installation; http://stackoverflow.com/questions/28223559/floor-identifier-not-found
I'm not familiar with the book, I've come across the header file
#include std_lib_facilities.h before, which has to be downloaded from somewhere (and there are different versions so you need to get the right one).

But still, the code you posted has an error at line 9, there is a missing semicolon after cin>>ch;
You could simplify the code, a lot of those headers aren't needed at this stage,
Try it with just #include <iostream> for now.
1
2
3
4
5
6
7
8
9
10
11
12
#include <iostream>

using namespace std;

inline void keep_window_open() { char ch; cin>>ch; }

int main()
{
    cout << "Hello, World!\n";
    keep_window_open();
    return 0;
}

@Moschops I've tried repairing the VS but the issue still occurs.
@Chervil I get that error even with that code. (repaired the syntax error too).

Should I just uninstall and install again VS?
Topic archived. No new replies allowed.