dmd linker (OPTLINK) gives Error 42: Symbol Undefined when using extern

Tal publictal at gmail.com
Sun Dec 25 12:47:04 PST 2011


Linking the following two files gives me a link-error:

a.d:
	import std.stdio;

	extern (D) string test ();

	void main()
	{
		writeln(test());
		readln();
	}
____________________________________
b.d:
	string test () {
		return "hello";
	}
____________________________________
the error I get is:

Error 42: Symbol Undefined _D1a4testFZAya`

---errorlevel 1

What is wrong ?


More information about the Digitalmars-d-learn mailing list