FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Can't read imports

 
Post new topic   Reply to topic     Forum Index -> Descent
View previous topic :: View next topic  
Author Message
Paul



Joined: 30 Nov 2007
Posts: 4

PostPosted: Fri Nov 30, 2007 7:56 pm    Post subject: Can't read imports Reply with quote

I posted this same query on the Build forum, but this may be the correct forum.

Everything used to work fine, but after updating Eclipse and Descent...

When I try to build a module that imports another (non-phobos) module I get an error message like the following at the import point.

module test cannot read file 'testpackage\test.d'

Looking over other posts on this forum I get the impression that the dmd.conf file is involved but I have no idea what is wrong or what it looks like when it's right.

Any suggestions??

Paul
Back to top
View user's profile Send private message
Paul



Joined: 30 Nov 2007
Posts: 4

PostPosted: Fri Nov 30, 2007 9:36 pm    Post subject: Reply with quote

Never mind.

I had the working directory set to the project_loc and the directory structure didn't reflect it. I changed it to the workspace_loc/source directory and it worked.

Getting older quickly and wiser slowly.

Paul
Back to top
View user's profile Send private message
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Mon Jun 16, 2008 11:46 am    Post subject: Cannot read file! I have the same problem Reply with quote

Hello,

I have a similar problem:

Installed and configured descent as shown in the descent-wiki.

A single main file compiles fine, even beeing lokated in a package.
Phobos works also fine, no problems to import std.stdio etc.

But a soon as I try to import a file written by myself I get an error "... cannot read file..."

At commandline I can compile it with "dmd main.d fileA.d" and it works, but with descent it doesn't.

It's just the same error as I would try to compile at commandline without all files typed: "dmd main.d" without fileA.d

Can someone help me please!?
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Mon Jun 16, 2008 8:15 pm    Post subject: Reply with quote

Hi 3-S-E,

Are you getting the error when you execute the external tool that compiles the file? Or you are getting that error in the editor itself?

Also, could you please tell me what is the structure of your project? Files, folders and include paths.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Tue Jun 17, 2008 2:41 am    Post subject: Error appears on rebuild Reply with quote

Hi,

I'm getting this error on rebuild with dmd(.exe), or dsss-0.75 (rebuild.exe).
The editor himself makes no problems, auto-completion works just fine.

My filestruct:

Workspace
-Projektname
--src
----package01
--------main.d
--------fileA.d
----package02
--------fileB.d

Error appears by importing fileA.d to main.d and also fileB.d to main.d

main.d:

Code:

module package01.main; // filled by descent

import std.stdio; // OK
import package02.fileB; // ERROR

int main(char[][] args){

FileB foo = new FileB(); // No error in editor

return 0;
}


fileB.d:
Code:

module package02.fileB; // filled by descent

class FileB{
public:
this(){}
~this(){}
}


Rebuild-Config:

Working-Directory: ${project_loc}
Arguments: ${resource_loc} -g


Console-output of dmd / dsss-rebuild:

Quote:

C:\Worksspace\Projectname\src\package01\main.d(4): module fileB cannot read file 'package02\fileB.d'


IMO it has something to do with the Arguments-Settings.
As mentioned bevor I can compile the project at commandline, but as soon as I omit for example fileB.d, the same error occures at command line:

"dmd.exe main.d fileA.d" works file if main.d imports only fileA.d
"dmd.exe main.d" fails if main.d imports fileA.d or fileB.d with same error-message

Enough informations?
Back to top
View user's profile Send private message
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Tue Jun 17, 2008 5:26 am    Post subject: Workaround Reply with quote

I've figured out a workaround for my problem, but this cannot be the only and optimal solution:

At "run" -> "external tools" -> "open external tools dialog" in the arguments-section I wrote

Quote:

"${resource_loc}\pak01\main.d ${resource_loc}\pak01\fileA.d -g"


As you can see there are all files listed which I want to build, import and link.

main.d imports fileA.d

Okay... next step is to select the source-folder (in my case "src") at the project explorer and NOT the main.d file.

The subfolder of "src" is "pak01" and the files in "pak01" are "main.d" and "fileA.d"

Okay... so here is the problem: All descent does is a command-line execution of dmd with the arguments given by the argument-menu.
Therefore I get the same error-message when I try to compile from command-line without declare all files to compile.

This is for true not an optimal solution, especially when a project contains dozens of files and packages. So I hope there is another way to configure descent.
Back to top
View user's profile Send private message
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Fri Jun 20, 2008 5:08 pm    Post subject: Any ideas? Reply with quote

Is there no better solution? Come on! Cool
Back to top
View user's profile Send private message
asterite



Joined: 01 Jun 2006
Posts: 235
Location: Buenos Aires, Argentina

PostPosted: Fri Jun 20, 2008 6:43 pm    Post subject: Reply with quote

Use:

Working-Directory: ${project_loc}/src

The working directory should always point to the root of your package hierarchy.

Hope that helps.
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Sat Jun 21, 2008 3:52 am    Post subject: Reply with quote

Great! Merci!

Such a simple solution but so hard to figure it out! Confused

My last question for now:

Is there a possibility to tell descent to compile and run a specific file without selecting it at the Project Explorer?! And: Is there an option to build and run a project in a row?
Back to top
View user's profile Send private message
3-S-E



Joined: 16 Jun 2008
Posts: 54

PostPosted: Tue Jun 24, 2008 7:38 am    Post subject: Never ending story! Reply with quote

Under ubuntu x64 dmd doesn't find some libraries or it doesn't work with 64bit libraries (but I don't know exactly what this is all about):

Click http://ng-world.de/ErrorMessages.txt for error messages!

So I configured my external tools to compile my modules with gdc-4.2.
One, and only one single module (my main.d module) compiles fine.
As soon as I import another module I get this error:

Click http://ng-world.de/ErrorMessages.txt for error messages!

The last line is in german and means: ld returns 1 as end-status.

It's not the import itself, its the use of the class-type, for example the constructor-call at line 7 of main.d: MyClass object1 = new MyClass();
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> Descent All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group