php--
php--

Reputation: 3217

Import D modules from multiple projects

I need to import modules from multiple projects to current project.

Currently I get following message from compiler:

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

Projects are set up as follows:

${HOME}/d_apps/steering

${HOME}/d_apps/path_find

${HOME}/d_apps/path_find/map/map.d includes steering.game_object

Compile command:

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

Upvotes: 0

Views: 75

Answers (2)

Kai Nacke
Kai Nacke

Reputation: 346

I suppose the path of game_object.d is ${HOME}/d_apps/steering/game_object.d. In this case the module is not found because there is no directory specified which contains steering/game_object.d. You need to add -I${HOME}/d_apps or move the file to ${HOME}/d_apps/steering/steering/game_object.d.

Upvotes: 1

Colin Grogan
Colin Grogan

Reputation: 2822

Just add steering/game_object.d at the start of your dmd command.

Upvotes: 1

Related Questions