Undefined reference error when array size is given
tcak via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jan 19 13:00:55 PST 2015
Code is as follows:
main.d
=========================
import core.sys.posix.poll;
void main(){
core.sys.posix.poll.pollfd[2] pollList;
}
=========================
Error:
main.d:(.text._Dmain+0x15): undefined reference to
`_D4core3sys5posix4poll6pollfd6__initZ'
Remove "2" and it works.
main.d
==========================
import core.sys.posix.poll;
void main(){
core.sys.posix.poll.pollfd[] pollList;
}
=========================
The error points to "__init". Struct is defined very simply.
struct pollfd
{
int fd;
short events;
short revents;
}
I defined same struct in main file, and defined a similar array.
There is no problem with that.
main.d
=========================
import core.sys.posix.poll;
struct pollfd2
{
int fd;
short events;
short revents;
}
void main(){
core.sys.posix.poll.pollfd[] pollList;
pollfd2[2] blah;
}
=========================
What is the reason of this error exactly?
More information about the Digitalmars-d-learn
mailing list