Page 1 of 1

Passing file handle to compiler

Posted: Wed Aug 11, 2010 1:40 pm
by Action
Hi,

I'm trying to use CodeLite together with the KEIL-compiler.
In general calling the compiler from the command line is not a problem. The thing is that KEIL wants to have a file where it can output its warnings and errors. If I call the compiler without a file a window opens, the messages are written there and the window closes again without the chance to read the warnings.
So is there a way to get a file handle to the output window of CodeLite in order to pass it to the command line for the compiler? Then the messages of KEIL should be written to the output window and I could read them.
Or is it possible to somehow open the file specified at the command line in the output window after compilation?

Thanks in advance for any reply.

Best regards

Re: Passing file handle to compiler

Posted: Wed Aug 11, 2010 5:15 pm
by eranif
Please give an example for how do you compile using the command line

This way, we could try and mimic this behaviour within codelite

Eran

Re: Passing file handle to compiler

Posted: Wed Aug 11, 2010 5:23 pm
by Action
Hi,

a call to the compiler from the command line would look like this:
"D:\KeilV700\UV4\Uv4.exe -r rtos.uv3.uvproj -o Build_Output.txt" where uv4.exe is the compiler, -r is the option for the project to compile and -o is the option for the file to write the output to.
Like I said, the compiler call and the project is no problem, but what do I pass for the output file?

Regards

Re: Passing file handle to compiler

Posted: Wed Aug 11, 2010 6:04 pm
by eranif
How did you achieve the first part? (calling Uv4.exe and passing -r etc)
Did you use the standard way of creating new compiler from settings -> build settings -> new compiler? or are you using the 'custom build' option from your project settings ?

Eran

Re: Passing file handle to compiler

Posted: Wed Aug 11, 2010 7:09 pm
by Action
Hi,

I simply used the custom build option of the project.
But if it requires creating a new compiler I'd be willing to do so :-)

Regards

Re: Passing file handle to compiler

Posted: Wed Aug 11, 2010 9:10 pm
by eranif
Action wrote:I simply used the custom build option of the project.
Ok... so can you please paste here the command you used for the build?

Whats wrong with passing it like this:

Code: Select all

D:\KeilV700\UV4\Uv4.exe -r rtos.uv3.uvproj -o Build_Output.txt
Eran

Re: Passing file handle to compiler

Posted: Thu Aug 12, 2010 12:06 pm
by Action
Hi,
Whats wrong with passing it like this:
As for the compiler run nothings wrong. The thing is that the compiler writes its warnings and compiler errors only (!) to the Build_Output.txt and not in the output window of Codelite. This means that I don't see any compiler output in Codelite (and therefore don't know if the compiler had an error or not).
After the compiler run - indepent on the result - Codelite always tells me that the build ended without errors and warnings although the compiler outputs three warnings in the Build_Output.txt.
That's why I was asking for the possibility to get a file handle to the output window so that I might pass it as a parameter to the compiler.

Regards

Re: Passing file handle to compiler

Posted: Thu Sep 09, 2010 10:14 am
by Action
Hi,

does your not answering mean that there's no way to achieve what I wanted?
Is there a way to get CodeLite to parse a file after compiling and display the file to the compiler-output-window?

Best regards

Re: Passing file handle to compiler

Posted: Thu Sep 09, 2010 12:45 pm
by eranif
Action wrote:does your not answering mean that there's no way to achieve what I wanted?
The fact that I did not answer only means that it slipped my mind, sorry.

I have an solution that will work:
- In your project settings, define a new 'post build' command (right click on your project and select 'PostBuild') with the following command:

Code: Select all

cat Build_Output.txt
Note that since the command contains relative path of Build_Ouptut.txt, codelite will search for it under the project directory (i.e. the location of your .project file)

- Since you are under Windows, download cat.exe from here:
http://sourceforge.net/projects/unxutil ... p/download

- Extract the cat.exe and place it somewhere under your system PATH

Now, once the build will end, codelite will 'cat' the content of the Build_Output.txt and it will be displayed in the Build Output window
I just tried it with gcc under Windows and it is working fine (errors are clickable and marked with red/orange, the error counter is outputing the correct error number as well)

Give it a try and let me know how it went,
Eran

Re: Passing file handle to compiler

Posted: Thu Sep 09, 2010 1:34 pm
by Action
eranif wrote:The fact that I did not answer only means that it slipped my mind, sorry.
No worries.

The solution with the cat-utility works just fine!
But I had to do some minor adjustments. I deducted that once I defined the post-build-command the custom build seems to be disabled - at least CodeLite tried to compile my project using mingw which of course didn't work.
So I simply put the compiler call and the cat.exe-call into a batch-file that is called from the custom build. And this works just fine!

Thank you very much for your help.

Best regards