www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Building and using a function library

reply "Charles Parker" <j831526 gmail.com> writes:
What does this error mean?
./min_cut.d(15): Error: module line_count from file 
../my_utils/line_count.d must be imported as module 'line_count'

My directory structure in question is:
.../D
       /min_cut   which contains min_cut.d which I'm building
       /my_utils  which contains line_count.d

I'm positioned in the min_cut directory. I have -I../ added as a 
root in my config file. I've tried both:
import line_count; and import my_utils.line_count; and this 2nd 
format (which I believed was correct) produced the above error.

line_count.d contains only one function: int line_count(string 
file_path)

This is supposed to be easy, but I'm just missing something:( Oh 
BTW, I'm working from tcsh on an iMac.

Thanx - Charlie
May 25 2014
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Sunday, 25 May 2014 at 19:07:10 UTC, Charles Parker wrote:
 ./min_cut.d(15): Error: module line_count from file 
 ../my_utils/line_count.d must be imported as module 'line_count'
That means you forgot the module line in line_count.d At the top of that file, add: module my_utils.line_count; and leave everything else the same and you should be ok. The error is saying that the name of the import line should always match the name of the module line which wasn't the case here.
May 25 2014
parent "Charles Parker" <j831526 gmail.com> writes:
On Sunday, 25 May 2014 at 19:14:05 UTC, Adam D. Ruppe wrote:
 On Sunday, 25 May 2014 at 19:07:10 UTC, Charles Parker wrote:
 ./min_cut.d(15): Error: module line_count from file 
 ../my_utils/line_count.d must be imported as module 
 'line_count'
That means you forgot the module line in line_count.d At the top of that file, add: module my_utils.line_count; and leave everything else the same and you should be ok. The error is saying that the name of the import line should always match the name of the module line which wasn't the case here.
BINGO:) I knew it was something basic:( I assumed the function name and the file name being the same was all that was needed - an obvious mistake. Thanx muchly - Charlie
May 25 2014