mbornet-hl / hl

Highlight (colorize) text data using regular expressions (efficient C program)
Other
118 stars 9 forks source link

compilation failed #4

Closed mauric closed 4 years ago

mauric commented 8 years ago

Hi, I have an issue with the compilation process. After clone the repo, and go to /src and made "make" there is a kind of references problem. I saw the code but I did not find any problem. So I don't know what its going wrong. I have this message in my terminal

cc -c -o cr_main.o cr_main.c cc -c -o cr_gpri.o cr_gpri.c lex -t cr_lex.l > cr_lex.c cc -c -o cr_lex.o cr_lex.c cr_main.o: In function cr_add_regexp': cr_main.c:(.text+0x125f): undefined reference tocr_clear_marker_flags' cr_main.o: In function main': cr_main.c:(.text+0x1401): undefined reference tocr_clear_marker_flags' cr_main.o: In function cr_disp_line': cr_main.c:(.text+0x2c1d): undefined reference tocr_same_colors' collect2: error: ld returned 1 exit status Makefile:8: recipe for target 'hl' failed make: *\ [hl] Error 1 rm cr_lex.c

Thanks..

mbornet-hl commented 8 years ago

Hi,

what OS are you using (Linux, AIX, HP-UX, Solaris, BSD, ...) ? What version / release ? What version of lex/flex ? What version of C compiler ? Thanks.

Martial Bornet

site : http://www.bornet.fr/

On 02/16/2016 10:28 PM, mauric wrote:

Hi, I have an issue with the compilation process. After clone the repo, and go to /src and made "make" there is a kind of references problem. I saw the code but I don't find any problem. So I don't know what its going wrong. I have this message in my terminal

cc -c -o cr_main.o cr_main.c cc -c -o cr_gpri.o cr_gpri.c lex -t cr_lex.l > cr_lex.c cc -c -o cr_lex.o cr_lex.c cr_main.o: In function |cr_add_regexp': cr_main.c:(.text+0x125f): undefined reference to|cr_clear_marker_flags' cr_main.o: In function |main': cr_main.c:(.text+0x1401): undefined reference to|cr_clear_marker_flags' cr_main.o: In function |cr_disp_line': cr_main.c:(.text+0x2c1d): undefined reference to|cr_same_colors' collect2: error: ld returned 1 exit status Makefile:8: recipe for target 'hl' failed make: *\ [hl] Error 1 rm cr_lex.c

Thanks..

— Reply to this email directly or view it on GitHub https://github.com/mbornet-hl/hl/issues/4.

mauric commented 8 years ago

Sorry, I forget that.

I'm using Kunbuntu 15.10 KDE plasma 5.5.3, Kernel Version 4.2.0-25 generic, 64bit. Flex version flex 2.5.39 and gcc version 5.2.1 20151010 (Ubuntu 5.2.1-22ubuntu2)

Mauric

mbornet-hl commented 8 years ago

It seems that the "inline" keyword is the origin of the problem. Remove it from the file "cr_main.c" each time it appears (see the definitions of the functions cr_clear_marker_flags() and cr_clear_marker_flags() ), and recompile using "make". It should be better.

mbornet-hl commented 8 years ago

Since I had no feedback from you, I close the issue.

leoheck commented 8 years ago

Hi, I am using Ubuntu 16.04 (gcc 5.4) with the same error. Your solution worked fine! Thank you.

By the way, why you have to put double pipes in this command: ./hl -V || : in your makefile?

mbornet-hl commented 4 years ago

Hi, I've just seen I haven't answered your question, sorry for that. The double pipe '||' is an OR operator for the shell. The command following the '||' is executed if and only if the command before the '||' fails, i.e. if it returns false, which in shell language is a non-zero return code. When -V is passed to hl, the command returns a non-zero return code. Here, the command following the '||' is ':', which is another name for 'true', which always returns true. That way, the command ./hl -V || :always returns true, and so make doesn't stop its execution because of an error.

mbornet-hl commented 4 years ago

Questions have been answered.