User forums => Using Code::Blocks => Topic started by: New to Code::Blocks on September 25, 2017, 05:27:43 am
Title: Compile single file to object file
Post by: New to Code::Blocks on September 25, 2017, 05:27:43 am
I am having a problem with "Compile single file to object file" that I do not know how to resolve. Code::Blocks version 16.01 Ubuntu version 16.04 LTS Code::Blocks updates from: http://ppa.launchpad.net/damien-moore/codeblocks-stable/ubuntu
"Source ext." l (el) is defined as follows: Command line macro: flex -o$file_dir/$file_name.scanner.cc $file Generated files (to be further compiled): $file_dir/$file_name.scanner.cc
"Source ext." y is defined as follows: Command line macro: bison -v -d $file -o $file_dir/$file_name.parser.cc Generated files (to be further compiled): $file_dir/$file_name.parser.cc $file_dir/$file_name.parser.hh
I do not recall making any changes to these (default definitions after installing Code::Blocks).
I created a new Code::Blocks project and added a .l and .y file to the project. I open the .l file and select menu item "Build" > "Compile current file". This results in the following error in the Code::Blocks "Build log" tab:
Flex /bin/sh: 1: Flex: not found Process terminated with status 127 (0 minute(s), 0 second(s)) 0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
Note that Flex has a capital F.
I open the .y file and select menu item "Build" > "Compile current file". This executes bison and shows me the errors in the .y file.
From Terminal: $ flex Scanner.l $ Flex Scanner.l No command 'Flex' found, did you mean: Command 'plex' from package 'fp-utils-3.0.0' (universe) Command 'flex' from package 'flex-old' (universe) Command 'flex' from package 'flex' (main) Command 'lex' from package 'flex-old' (universe) Command 'lex' from package 'flex' (main) Command 'clex' from package 'clex' (universe) Command 'jlex' from package 'jlex' (universe) Command 'alex' from package 'alex' (universe) Flex: command not found $ bison Parser.y "Parser.y", line 1: junk after `%%' in definition section Segmentation fault (core dumped) $ whereis flex flex: /usr/bin/flex /usr/share/man/man1/flex.1.gz /usr/share/info/flex.info-2.gz /usr/share/info/flex.info-1.gz /usr/share/info/flex.info.gz $ whereis bison bison: /usr/bin/bison /usr/share/man/man1/bison.1.gz /usr/share/info/bison.info-5.gz /usr/share/info/bison.info.gz /usr/share/info/bison.info-2.gz /usr/share/info/bison.info-1.gz /usr/share/info/bison.info-3.gz /usr/share/info/bison.info-4.gz $
When a .l file is open in Code::Blocks and I select menu item "Build" > "Compile current file", why is the command Flex (with capital F) being invoked?
John
Title: Re: Compile single file to object file
Post by: oBFusCATed on September 25, 2017, 09:15:10 am
Please try the latest version (11176, you'll probably need to build from source or create packages manually) and report if the problem is still present. If it is please post a minimal project which could be used to reproduce it.
Title: Re: Compile single file to object file
Post by: BlueHazzard on September 25, 2017, 09:51:38 am
i tried this on windows (~20 commits behind HEAD) and the command line seems to be ok (i have not installed bison, so i can only check if the generated command line is ok)
Code
-------------- Build: Debug in Flex (compiler: GNU GCC Compiler)---------------
[ 33.3%] flex -oG:\tmp\Flex/test.scanner.cc G:\tmp\Flex\test.l Execution of 'flex -oG:\tmp\Flex/test.scanner.cc G:\tmp\Flex\test.l' in 'G:\tmp\Flex' failed.