0
所以我正在做我的第一個「freestyle」項目在c + +。我很想嘗試建立一個基於opengl的引擎。我試圖創建一個可以存儲變量和結構的cpp ...這樣,代碼的所有其他部分都可以輕鬆地使用自定義結構和訪問並寫入變量(這是生命計數器會去的地方)。如何製作一個漂亮乾淨的變量存儲器?有問題通過過濾器獲取數據
但是我注意到,雖然它編譯...引擎不像我使用我的自定義Coord3D結構在一個.cpp,我已經放在過濾器(幷包括Variables.cpp)較低。
我怎樣才能得到這個,所以它工作正常?
櫃面圖像的arent工作....
Variables.cpp (located outside of the filters and folders)
using namespace std;
typedef float acc;//Defines the accuracy of the program
#include "Dependencies\glew\glew.h"
#include "Dependencies\freeglut\freeglut.h"
#include <iostream>
struct Config{
bool Depth;
};
struct Coord3D{
acc x;
acc y;
acc z;
};
struct Coord2D{
acc x;
acc y;
};
和
Shader_Loader.cpp (located inside of a folder/filter called "Core")
#pragma once
#include "../Variables.cpp"
Coord3D it;
it.x = 1;
it.y = 1;
it.z = 1;
//THe debugger likes to put red underlines under the last 3 lines under "it" however the program compiles....?
Eww。 '#include「___。cpp」' – NathanOliver
有一個頭文件來聲明'struct Coords3D;'並將它包含在需要使用的地方。 –
@NathanOliver ...它有什麼問題嗎?我有../,所以我可以去一個過濾器和訪問最大的文件夾。沒有這個neccesary? – Andrew