Real Simple Question?

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 22 15:09:55 PDT 2016


On Saturday, October 22, 2016 21:34:36 WhatMeWorry via Digitalmars-d-learn 
wrote:
> Ok, but now I'm getting these error in my new
> mypackage/constants.d
>
> ..\common\vertex_data.d(5,15): Error: undefined identifier
> 'GLfloat'
> ..\common\vertex_data.d(53,12): Error: undefined identifier 'vec3'

mypackage/constants.d needs to import the modules for any of the types it's
using, otherwise it doesn't know about them. Modules are not textually
included like header files are in C++ (compilation times would be _way_
worse if they were), so a module only has access to what it imports, and
it's not affected by anything that imports it.

> Is there a way to just suck in the text from say a .txt file that
> would not be compiled before inclusion in main.d?

String imports is a feature, but then you end up with multiple copies of the
array in your program instead of one, and string imports are almost always
the wrong solution.

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list