Thread overview | ||||||
---|---|---|---|---|---|---|
|
November 13, 2010 Trouble with OPTLINK | ||||
---|---|---|---|---|
| ||||
Every time I try to compile a multi-file project the linker gives me a whole list of "Symbol undefined" errors. For example, given the extremely simple source file test.d: module test; import test2; import std.stdio; void main() { writef("%d",foo); } And test2.d: module test2; int foo() {return 42;} Then I get the following error when I run dmd test: OPTLINK (R) for Win32 Release 8.00.2 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined _D5test23fooFZi --- errorlevel 1 I've already tried cleaning up all build files and adding the current directory to the system PATH, both to no avail. This does not happen while I compile single-file programs that import from the standard library. Does anyone have an idea how to fix this? Thanks in advance. |
November 13, 2010 Re: Trouble with OPTLINK | ||||
---|---|---|---|---|
| ||||
Posted in reply to Aardvark Soup | Aardvark Soup:
> I've already tried cleaning up all build files and adding the current directory to the system PATH, both to no avail. This does not happen while I compile single-file programs that import from the standard library. Does anyone have an idea how to fix this?
This is a problem that Walter seems to think it doesn't exist.
The solution is to add all the module names you use in the command line.
Bye,
bearophile
|
November 14, 2010 Re: Trouble with OPTLINK | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | On 11/13/2010 1:14 PM, bearophile wrote:
> Aardvark Soup:
>
>> I've already tried cleaning up all build files and adding the current directory to the system PATH, both to no avail. This does not happen while I compile single-file programs that import from the standard library. Does anyone have an idea how to fix this?
>
> This is a problem that Walter seems to think it doesn't exist.
> The solution is to add all the module names you use in the command line.
>
> Bye,
> bearophile
Interesting way you phrased your response.
The behavior of dmd here is explicit and specifically intended. It's exactly the same as every c and c++ compiler's behavior. It's different than java. And interpreted languages are a different enough execution model to not compare them directly.
rdmd can be used to build and execute multi-file applications more like traditional scripting languages.
Later,
Brad
|
November 14, 2010 Re: Trouble with OPTLINK | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile | Op 13-11-2010 22:14, bearophile schreef:
> Aardvark Soup:
>
>> I've already tried cleaning up all build files and adding the current
>> directory to the system PATH, both to no avail. This does not happen
>> while I compile single-file programs that import from the standard
>> library. Does anyone have an idea how to fix this?
>
> This is a problem that Walter seems to think it doesn't exist.
> The solution is to add all the module names you use in the command line.
>
> Bye,
> bearophile
Ah, of course! Thanks, the problem is solved now. I've been so used to using IDE's when programming in C++ and Java when programmng multi-file projects I always assumed this was generally being done automatically as long as all files were in the same folder.
|
Copyright © 1999-2021 by the D Language Foundation