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

Improve portability #7

Open
danboid opened this issue Nov 13, 2019 · 3 comments
Open

Improve portability #7

danboid opened this issue Nov 13, 2019 · 3 comments

Comments

@danboid
Copy link

danboid commented Nov 13, 2019

Nice project!

I just tried to build C-edit under Serenity OS and got this far:

i686-pc-serenity-gcc    -c -o main.o main.c
i686-pc-serenity-gcc    -c -o rterm.o rterm.c
i686-pc-serenity-gcc    -c -o listc.o listc.c
i686-pc-serenity-gcc    -c -o scbuf.o scbuf.c
i686-pc-serenity-gcc    -c -o opfile.o opfile.c
i686-pc-serenity-gcc    -c -o uintf.o uintf.c
i686-pc-serenity-gcc    -c -o fileb.o fileb.c
i686-pc-serenity-gcc    -c -o keyb.o keyb.c
opfile.c: In function 'listFiles':
opfile.c:612:25: error: 'DT_DIR' undeclared (first use in this function); did you mean 'DIR'?
       if(dir->d_type == DT_DIR) {
                         ^~~~~~
                         DIR
opfile.c:612:25: note: each undeclared identifier is reported only once for each function it appears in
opfile.c:651:25: error: 'DT_REG' undeclared (first use in this function); did you mean 'F_RED'?
       if(dir->d_type == DT_REG) {
                         ^~~~~~
                         F_RED
<builtin>: recipe for target 'opfile.o' failed
make: *** [opfile.o] Error 1

Apparently you can use stat instead of d_type to make it more portable. Apparently d_type is a BSDism.

@velorek1
Copy link
Owner

Interesting, I didn't know about this. I'll look into it and see what I can do.
Also, feel free to modify it yourself if you feel like doing it.
Thank you for your comment!

@catafest
Copy link

I try to build with make on Fedora 33 :

[mythcat@desk src]$ make
cc -Wall -Wextra -fsigned-char    -c -o main.o main.c
cc -Wall -Wextra -fsigned-char    -c -o rterm.o rterm.c
cc -Wall -Wextra -fsigned-char    -c -o listc.o listc.c
cc -Wall -Wextra -fsigned-char    -c -o scbuf.o scbuf.c
cc -Wall -Wextra -fsigned-char    -c -o opfile.o opfile.c
cc -Wall -Wextra -fsigned-char    -c -o uintf.o uintf.c
cc -Wall -Wextra -fsigned-char    -c -o fileb.o fileb.c
cc -Wall -Wextra -fsigned-char    -c -o keyb.o keyb.c
cc -Wall -Wextra -fsigned-char    -c -o tm.o tm.c
cc  -o cedit main.o rterm.o listc.o scbuf.o opfile.o uintf.o fileb.o keyb.o tm.o 
/bin/ld: scbuf.o:(.bss+0x30): multiple definition of `rows'; main.o:(.bss+0x112aa30): first defined here
/bin/ld: scbuf.o:(.bss+0x34): multiple definition of `columns'; main.o:(.bss+0x112aa34): first defined here
collect2: error: ld returned 1 exit status

[mythcat@desk src]$ make -v
GNU Make 4.3
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

@velorek1
Copy link
Owner

I see, I've changed some variable names to avoid these conflicts.
It should work fine now.
(Mind due, it is still a demo version)
Thank you for letting me know.

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

No branches or pull requests

3 participants