Compilation errors. Having trouble finding the problem.

I'm currently reading C++ Primer fifth edition which covers C++11.

I came across this code snippet on section 1.5.2, but had trouble compiling it. I included the folders that contain the header files in the "Include Directories" in visual studio, so the header files are there.

How would I fix this problem? Thank you very much for your time.

The errors I got during compilation are below:

Severity Code Description Project File Line
Error C2375 'lround': redefinition; different linkage Learning c:\program files (x86)\windows kits\10\include\10.0.10150.0\ucrt\math.h 509


Severity Code Description Project File Line
Error (active) linkage specification is incompatible with previous "lround" (declared at line 74 of "c:\Users\Jae\Documents\Visual Studio 2015\Projects\PrimerExampleCode\Version_test.h") Learning c:\Program Files (x86)\Windows Kits\10\Include\10.0.10150.0\ucrt\math.h 509


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "stdafx.h"
#include "Sales_item.h"
#include <iostream>

int main()
{
	Sales_item item1, item2;

	std::cin >> item1 >> item2;

	if (item1.isbn() == item2.isbn()) {
		std::cout << item1 + item2 << std::endl;
	}
	else {
		std::cerr << "Data must refer to same ISBN" << std::endl;

		return -1;
	}

    return 0;
}

Last edited on
Please post your Sales_item.h file.

Topic archived. No new replies allowed.