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

Compilation errors in screen.c and output.c #118

Closed
ghost opened this issue Jan 31, 2021 · 6 comments
Closed

Compilation errors in screen.c and output.c #118

ghost opened this issue Jan 31, 2021 · 6 comments

Comments

@ghost
Copy link

ghost commented Jan 31, 2021

When compiling less with mingw, I get compilation errors.

screen.c

  1. screen.c:2363:42: error: 'FOREGROUND_BRIGHT' undeclared
  2. win_set_4bit_color returns a value but the return type is void

output.c
output.c:375:3: error: too many arguments to function 'win_flush

I see these errors as of commit c6eb7aa

@gwsw
Copy link
Owner

gwsw commented Feb 1, 2021

Should be fixed in 5e9e01a.
The Windows builds are not well tested at this point, so let me know if you find any other issues.

@gwsw gwsw closed this as completed Feb 1, 2021
@gwsw
Copy link
Owner

gwsw commented Feb 1, 2021

Correction: fixed in d5b811c.

@ghost
Copy link
Author

ghost commented Feb 2, 2021

There were additional errors in screen.c that I did not report because I thought they were consequences of the win_set_4bit_color() problem. I was wrong and here they are:

screen.c: In function 'at_enter':
screen.c:2580:2: error: 'else' without a previous 'if'
else if (attr & AT_BLINK)
^~~~
screen.c:2582:2: error: 'else' without a previous 'if'
else if (attr & AT_BOLD)
^~~~
screen.c:2584:2: error: 'else' without a previous 'if'
else if (attr & AT_UNDERLINE)
^~~~
mingw32-make: *** [Makefile.wng:76: screen.o] Error 1

These errors appear to be caused by the semicolons at the end of the SETCOLORS calls. The SETCOLORS macro, defined on line156, includes curly braces and so the semicolon terminates the if-statement starting on line 2576.

In my opinion the simplest "fix" is to delete the semicolons. A better solution, I think, would be to remove the braces in the macro definition but it uses other macros that also have braces and so additional changes would be required.

@ghost
Copy link
Author

ghost commented Feb 2, 2021

Actually, another simple solution would be to use a curly-brace pair after each else if. For example:

else if (attr & AT_STANDOUT)
{
	 SETCOLORS(so_fg_color, so_bg_color);
}

@ghost
Copy link
Author

ghost commented Feb 2, 2021

Once I fixed the compilation errors in screen.c, I now see a link error:

gcc -L/mingw-w64/x86_64-8.1.0-win32-seh-rt_v6-rev0/mingw64/opt/lib -o less main.o screen.o brac.o ch.o charset.o cmdbuf.o command.o cvt.o decode.o edit.o filename.o forwback.o help.o ifile.o input.o jump.o line.o linenum.o lsystem.o mark.o optfunc.o option.o opttbl.o os.o output.o pattern.o position.o prompt.o search.o signal.o tags.o ttyin.o version.o -lregex
line.o:line.c:(.text+0x1e1e): undefined reference to `tput_color'
collect2.exe: error: ld returned 1 exit status
mingw32-make: *** [Makefile.wng:104: less] Error 1

I'm guessing that this happens because tputs_color is defined only if MSDOS_COMPILER is not defined.

@gwsw
Copy link
Owner

gwsw commented Feb 2, 2021

Ah yes, set_color_map should not be calling tput_color. I will look into this.

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

1 participant