环境:VS2010,WIN7 32位旗舰版
项目描述:
1、aa.hpp
#ifndef _AA_HPP
#define _AA_HPP
#include <string>
#include <iostream>
#include <stdexcept>
using namespace std;
class AA
{
public:
static void aa();
};
#endif
2、aa.cpp
#include "aa.hpp"
void AA::aa()
{
int a = 0;
return;
}
3、test.h
#ifndef TEST_HPP
#define TEST_HPP
#include <iostream>
#include <sstream>
#include <string>
using namespace std;
#include "aa.hpp"
#endif
4、test.cpp
#include "test.h"
using namespace std;
int main()
{
AA::aa();
return 0;
}
工程图如下:
,另外包含aa.hpp和aa.cpp所在目录。然后编译报错,错误为: