why can't find the .h file!

I begin a Blank solution that named AllInOne.ADD a C++ Win32 project named
Math Library and change the Application Settings to a static library.

Next,Select a C++ Win32 Console application and name it Harness.
MathLibrary project in Solution Explorer add a Generic C++ Class that named Arithmetic.


In Solution Explorer, right-click the Harness project and choose Properties.

Under Configuration Properties on the left, expand the C/C++ folder. Click General. Click next to Additional Include Directories on the left and type the relative path to the MathLibrary folder:

../MathLibrary


Solution Explorer, right-click the Harness project and choose Properties.

Under Configuration Properties on the left, expand the Linker folder. Click Input. Click next to Additional Dependencies on the left and type :



../MathLibrary/Debug/MathLibrary.lib


the code in Arithmetic.h:

#pragma once

class Arithmetic
{
public:
Arithmetic(void);
~Arithmetic(void);
double Add(double num1, double num2);
double Subtract(double num1, double num2);
double Multiply(double num1, double num2);
double Divide(double num1, double num2);
};



Arithmetic.cpp code:

#include "StdAfx.h"
#include ".\arithmetic.h"

Arithmetic::Arithmetic(void)
{
}

Arithmetic::~Arithmetic(void)
{
}

double Arithmetic::Add(double num1, double num2)
{
return num1 + num2;
}

double Arithmetic:: Subtract(double num1, double num2)
{
return num1 - num2;
}

double Arithmetic::Multiply(double num1, double num2)
{
return num1 * num2;
}

double Arithmetic::Divide(double num1, double num2)
{
return num1 / num2;
}

// Harness.cpp code:

#include "stdafx.h"
#include "arithmetic.h"
#include <iostream>
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
Arithmetic a;
cout << "1.2 + 3.2 = " << a.Add(1.2, 3.2) << endl;
cout << "2.1 * 3 = "<< a.Multiply(2.1, 3) << endl;
cin.get();

return 0;
}


finally,i change the Harness project in Solution Explorer As Startup Project.
but can't been compiled.

throw a error:
c:\Documents and Settings\jushu\My Documents\Visual Studio Projects\AllInOne\Harness\Harness.cpp(5) : “arithmetic.h”: No such file or directory


who may help me ! thanks!


Answer this question

why can't find the .h file!

  • jimmy06

    Ok, one problem you may have is with the additional include directories, try changing the / to a \.

    If that doesn't work copy the header file itself into the project directory.



  • valentin tihomirov

    Hi,

    This is my guess.

    How about changing your Arithmetic.h to arithmetic.h

    Hope this helps.


  • Marcus Sonntag

    Hi,

    Check the location of the following file;

    #include ".\arithmetic.h"

    Hope this helps.


  • CodeTyper

     lbsjs2005 wrote:

    throw a error:
    c:\Documents and Settings\jushu\My Documents\Visual Studio Projects\AllInOne\Harness\Harness.cpp(5) : “arithmetic.h”: No such file or directory
    who may help me ! thanks!

    Well.. check whether the arithmetic.h file is there in the exact path ... try search that .h file in ur drive .



  • MikePagel

    now, can't be complied yet.why My complier is broken


  • why can't find the .h file!