Java에서 C++로 마이그레이션 중입니다. C++은 클래스 파일을 별도의 파일로 선언하는 것을 어렵게 만듭니다. 그래서 난 내 MAIN.CPP에 도움,g ++에서 헤더 파일을 찾을 수 없습니다.
필요합니다
#include "Sphere.h"
using namespace std;
.....
...
..
int main(void) {
Sphere *earth = new Sphere(sphere_start ,sphere_end);
...
..
.
을 내 Sphere.h
class Sphere
{
public:
Sphere(int,int);
}
에 내 Sphere.cpp
#include "Sphere.h"
using namespace std;
int sphere_start, sphere_end;
Sphere::Sphere (int a, int b)
{
sphere_start = a;
sphere_end = b;
}
void Sphere::render(int i)
{
....
..
.
}
에서 이것은 내가 생각하기에 매우 기본적인 코드는 다음과 같은 오류가 발생한다.
main.cpp:14:20: fatal error: Sphere.h: No such file or directory
compilation terminated.
왜?
모든 파일이 같은 디렉토리에있는 ...
를 또는 어떤 파일이 –
죄송 파일은 동일한에없는 예배 규칙서. lol stupid me –
어떻게 모든 헤더 파일이 설치되어 있고 필요한 모든 dev-packages가 설치되어 있고 소스 파일이 올바른 헤더 경로를 참조하는지는 분명하지만이 문제를 "디버그"할 수 있지만 컴파일러는 여전히 헤더 파일. –