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