Eclipse expert help needed! I have set up a makefile project to compile and link HCS12 code using the free codewarrior tools. It all seems to work well, but the only error/warning/information output I can get is to the console, with nothing being scanned from the console into the Problems window. I set up a regular expression error parser(Window -> Preferences -> C/C++ -> Build -> Settings -> Error Parsers) to scan the console for the appropriate information. If I search the console output (click in output and F) using find/replace with "regular expressions" checked, I find the warnings and errors--they just never get to the Problems tab.
I have enabled the error parser in (Project->Properties->C/C++ Build->Settings->ErrorParsers).
Somewhere I read that I need to enable this in C/C++ Makfile settings--but I cannot fine any settings which include the name "Makefile"; did I set up my project wrong??
Any suggestions or ideas on how to get my parsed errors into the problems window?
Eclipse Luna, Windows 7 professional.
It seems that the Regex parser for Eclipse (at least the older version I am currently using) assumes you start at the beginning of a line of text and end at the end of a line of text. My compiler errors were spanning multiple lines; I found a switch in the compiler which allowed it to output the errors in "microsoft format", which was then on a single line.
the new warning line looks like
.\CODE\LIBCODE\CodeLibraries\Drivers\CI2C1.C(312): WARNING C1801: Implicit parameter declaration for 'CI2C1_OnMasterBlockSent'
regex that works is now
[^"\n]\([^"(])((\d+)): WARNING C(\d+):([^\n]*)
of particular note is the [^"\n]*\ at the beginning of the regex expression, which matches all characters from the beginning of the line until the last \ is found--this is the piece I was missing. Eclipse Kepler is rather unforgiving about the regex it requires.
and we have
File $1 (just the file name--eclipse adds the path mysteriously if the file is in a code directory of the project)
Line $2 (gathers the line number of the error)
Descrioption $4 ( I ignore WARNING and the warning number, and capture the description of the error to the end of the line)
I now have a useful and somewhat more modern IDE to work with ancient code which grew from the assembly code over many years and was never parsed out into libraries or restructured into modern levels of abstraction.
Related
I'm new to programming so I feel there is something simple I'm missing here.
I'm using the latest version of Mac and I've just installed Code::Blocks along with Xcode so I can use the gcc compiler.
I created a new "console application" project and the code for a hello world program shows up.
I built this code and it gave me 0 errors and 0 warnings so I thought it was off to a good start.
But when I go to run this code all I get is the following in my Terminal window:
*/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
Ryan-McMullens-iMac:~ Ryan$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
sh: /Users/Ryan/Documents/C++: No such file or directory
Process returned 127 (0x7F) execution time : 0.003 s
Press ENTER to continue.*
I've checked to make sure its using the gcc compiler. I've also tried creating a C++ directory in my documents folder but that didn't help.
Like I said, I feel like I'm just missing a step somewhere so any help would be really appreciated!
Thanks!
Try avoiding using '+' and spaces in the name of directories.
Many program don't handle escaping of pathnames when running external tools like compiler, linker or when calling the final executable.
Remove spaces from your path. It seems that codeblocks does not quote the paths, so every space will be introducing a new command or parameter. The problem here is this part:
C++ book
because it has a whitespace.
I'm new to programming so I feel there is something simple I'm missing here.
I'm using the latest version of Mac and I've just installed Code::Blocks along with Xcode so I can use the gcc compiler.
I created a new "console application" project and the code for a hello world program shows up.
I built this code and it gave me 0 errors and 0 warnings so I thought it was off to a good start.
But when I go to run this code all I get is the following in my Terminal window:
*/Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
Ryan-McMullens-iMac:~ Ryan$ /Applications/CodeBlocks.app/Contents/MacOS/cb_console_runner DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:. /Users/Ryan/Documents/C++ book stuff/SayHello/bin/Debug/SayHello
sh: /Users/Ryan/Documents/C++: No such file or directory
Process returned 127 (0x7F) execution time : 0.003 s
Press ENTER to continue.*
I've checked to make sure its using the gcc compiler. I've also tried creating a C++ directory in my documents folder but that didn't help.
Like I said, I feel like I'm just missing a step somewhere so any help would be really appreciated!
Thanks!
Try avoiding using '+' and spaces in the name of directories.
Many program don't handle escaping of pathnames when running external tools like compiler, linker or when calling the final executable.
Remove spaces from your path. It seems that codeblocks does not quote the paths, so every space will be introducing a new command or parameter. The problem here is this part:
C++ book
because it has a whitespace.
When using GDB 7.4 or 7.5 (haven't tested older versions), is it possible to add breakpoints to files which reside in a folder path that includes commas? I've been trying to get it to work (when working on the debugger interface of Dev-C++), but GDB is interpeting my commands wrong.
I use the following command to send breakpoint commands to GDB:
// sets break at line 13 in mentioned file using filename:linenum
break "C:/Foo,Bar/main.c":13
In other words, \ is replaced by / to avoid accidental escaping and for extra safety "" is added around the filename. Should work fine right?
Well, no. For some reason GDB clips the file path and tries to execute:
break "C:/Foo":13
... and it throws a generic error:
"Error in re-setting breakpoint 1: Function "C:/Foo" not defined.
Any ideas how I can fix this? I haven't been able to find anything useful regarding commas and GDB filenames here and on Google.
You can't do that as gdb use comma to separate multiple expression, so it react as you give it two paths.
Can i go to the line of error , while compiling a C or C++ project ? Usually by executing make , and parse the error string , and go to the specific file , and the line with errors.
Is there already an usable plugin ?
Yeah this is already buit into vim. After typing :make type :cwindow to bring up the error list. You can then navigate to the errors using this window.
You can as well after :mak or :make do :cope to open the window with compiler output and once you are done :clo to close it.
Use :cn and :cp for jumping to next and previous error or when you are in the window go to line that has the error with file name, line & column and press enter to jump there.
IIRC, this functionality is built into vim. A quick google search revealed this useful link. This describes vim's features for navigating the errors after a make.
I have a batch file that tries to compile a static library using Borland C++ Builder 6.0
It is called from Borland make (makefile created with bpr2mak) which is called from a .bat file (used to compile the whole project with Visual Studio and some Borland C++ Builder legacy projects), which is called from a bash shell script running inside Cygwin.
When I run the .bat file directly from a Cygwin shell, it runs OK, but when its being run from a Program calling cygwin with Boost::Process::launcher I'm getting this error:
C:\ARQUIV~1\Borland\CBUILD~1\Bin\..\BIN\TLib /u bclibs.lib #MAKE0000.###
DOS-reported error: Bad file number
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
opening 'MAKE0000.###'
** error 1 ** deleting bclibs.lib
It's a complicated scenario, but this Program which calls cygwin is run whenever we need to build our software package which needs to be build for various Linux distos and Windows 32 and 64-bit.
Note: It's the only Borland Project failing, the other compile just fine (it's the only static library using borland also, so it can be some problem with the TLib tool.
The problem was that TLib does not like to have his output redirected (seen here) without having an input pipe as well. Solved by creating an input pipe to in the Boost::Process::launcher using set_stdin_behavior
I'm just guessing here, but this may have to do with long filenames and/or spaces in paths.
1) Modify your makefile so it would save current environment to a file, immediately before executing the failing command (set > d:\env.txt & echo CD=%CD% >> d:\env.txt). Then run it both ways (directly and via program) and compare the environments of good run and bad run.
2) Using filemon from Sysinternals, capture logs of disk access in both cases (these logs are going to be huge, though you can uncheck everything except Open in the filter to reduce the size). Again, compare and check for clues...
3) Try instaling everything involved to paths conforming to 8.3 scheme.
This error is not related to C++ itself. It happens when your build script opens too much files (more than defined in DOS command processor environment). To resolve this issue try to set value of files variable to 253. For Windows XP this variable defined in the file %WINDIR%\system32\config.nt.
files=253
Seems it is known bug in Borland C++ tools. Here is description and possible workaround for this issue:
Problem: Some static Lib projects will
not link correctly when compiled. You might see something
like this :
J:\Borland\CBUILD~1\bin\..\BIN\TLib /u debug\jpegD.lib #MAKE0000.###
DOS-reported error: Bad file number
TLIB 4.5 Copyright (c) 1987, 1999 Inprise Corporation
opening 'MAKE0000.###'
** error 1 ** deleting debug\jpegD.lib
MAKE failed, returned : 1
Workaround : In some cases (where the "Bad file number" error is seen) it may be possible to work around this by specifying -tDEFLIB.BMK in the BPR2MAKE Options field, and Turning off the "Capture Make Output" option.
I have not tested it, but I hope that helps.