Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when building: "‘struct dirent’ has no member named ‘d_reclen’" #141

Closed
ForsakenHarmony opened this issue Feb 10, 2018 · 5 comments
Assignees
Labels
Milestone

Comments

@ForsakenHarmony
Copy link

ForsakenHarmony commented Feb 10, 2018

dirent.c:147:8: error: ‘struct dirent’ has no member named ‘d_reclen’
       d->d_reclen + 1, ENCODING_UTF8 );
        ^~

Reproduction Steps:

  1. follow linux instructions in cygwin
  2. error when executing make

LCUI version: latest master
OS and version: Win10
Build tools: cygwin make

@ForsakenHarmony ForsakenHarmony changed the title Error when building Error when building: "‘struct dirent’ has no member named ‘d_reclen’" Feb 10, 2018
@ForsakenHarmony
Copy link
Author

also found this which doesn't have the field
http://pubs.opengroup.org/onlinepubs/7908799/xsh/dirent.h.html

@lc-soft
Copy link
Owner

lc-soft commented Feb 11, 2018

In Windows, you need use VisualStudio to compile it.

I have not tried using cygwin make, maybe you can try to change config.h file, add macro define:

#define LCUI_BUILD_IN_WIN32
#define _WIN32

@ForsakenHarmony
Copy link
Author

ForsakenHarmony commented Feb 11, 2018

I'm trying to do it without visual studio because I want to make rust bindings

I found a workaround for this issue, which is replacing d->d_reclen by __builtin_offsetof (struct dirent, d_name) + strlen (d->d_name) + 1

@lc-soft
Copy link
Owner

lc-soft commented Feb 25, 2018

Any other questions need my help?

@lc-soft lc-soft self-assigned this Mar 25, 2018
@lc-soft lc-soft added this to the 1.0.0 milestone Mar 25, 2018
@lc-soft
Copy link
Owner

lc-soft commented Mar 27, 2018

-	LCUI_DecodeString( dir->entry.name, d->d_name, 
-			   d->d_reclen + 1, ENCODING_UTF8 );
+	LCUI_DecodeString( dir->entry.name, d->d_name, 0, ENCODING_UTF8 );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants