On Friday, 10 July 2015 at 00:24:44 UTC, anonymous wrote:
On Thursday, 9 July 2015 at 22:05:23 UTC, codenstuff wrote:
I am trying to import module and compile.

The compiler produces message

map/map.d(9): Error: module game_object is in file 'steering/game_object.d' which cannot be read
import path[0] = /usr/include/dmd/phobos
import path[1] = /usr/include/dmd/druntime/import
make: *** [main] Error 1


This error message doesn't mention the import path you add below with "-I${HOME}/d_apps/steering". It should. Looks like you copied the output of a different command.

How can I compile? Is it possible to modify import path?

Modules are set up as

${HOME}/d_apps/steering (contains steering/game_object.d)

Is that
"${HOME}/d_apps/steering/steering/game_object.d" or is it
"${HOME}/d_apps/steering/game_object.d"?

${HOME}/d_apps/path_find (contains map/map.d)

In map.d I import as

import steering.game_object;

The compile command

dmd map/map.d main_visual.d -I${HOME}/d_apps/steering

If the file is "${HOME}/d_apps/steering/steering/game_object.d", then this import path should be ok.

If the file is "${HOME}/d_apps/steering/game_object.d", then that import is wrong, and you'd have to pass the import path as "-I${HOME}/d_apps" instead.

(Adam D. Ruppe already said the following, but maybe he wasn't verbose enough.) Even when the import path is fixed, this can't compile because you're not passing game_object.d to the compiler. You have multiple options: You can pass all source files to dmd. You don't need to tinker with the import paths then. Or you can use rdmd instead of dmd (or rather on top of it). rdmd takes a single source file, discovers the imported modules, and passes everything to dmd. It needs proper import paths to work its magic, of course.

The path is ${HOME}/d_apps/steering/steering/game_object.d

Compile command is

dmd map/map.d main_visual.d -ofmain_visual -H -gc -unittest -L-lDgame -L-lDerelictUtil -L-lDerelictGL3 -L-lDerelictSDL2 -L-ldl -I/home/real/d_apps/dgame/source -I/home/real/d_apps/derelict_util/source -I/home/real/d_apps/derelict_gl3/source -I/home/real/d_apps/derelict_sdl2/source -I/home/real/d_apps/steering

Compiler message is same

Reply via email to