velorek1 / c-edit

A text editor in C with drop down menus from scratch. No ncurses.
MIT License
250 stars 18 forks source link

Improve portability #7

Open danboid opened 5 years ago

danboid commented 5 years ago

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 commented 5 years ago

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 commented 3 years ago

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 commented 3 years ago

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.