Can't access function from header file

后端 未结 2 1450
滥情空心
滥情空心 2021-01-22 05:04
//head.h//
extern int sum(int,int);
//head.cpp//

#include \"head.h\"
#include \"stdafx.h\"
int sum(int x, int y)
{
return (x+y);
}


        
相关标签:
2条回答
  • 2021-01-22 05:28

    You need to place the inclusion of head.h after stdafx.h. When precompiled headers are enabled the compiler will ignore the contents of all includes that occur prior to (in this case) the inclusion of stdafx.h .

    0 讨论(0)
  • 2021-01-22 05:42

    Either remove stdafx.h from the project, and turn of precompiled headers.. or try moving head.h to be included after stdafx.h instead of before.

    0 讨论(0)
提交回复
热议问题