Passing file handle to compiler

General questions regarding the usage of CodeLite
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Passing file handle to compiler

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Passing file handle to compiler

Post 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
Make sure you have read the HOW TO POST thread
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Re: Passing file handle to compiler

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Passing file handle to compiler

Post 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
Make sure you have read the HOW TO POST thread
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Re: Passing file handle to compiler

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Passing file handle to compiler

Post 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
Make sure you have read the HOW TO POST thread
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Re: Passing file handle to compiler

Post 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
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Re: Passing file handle to compiler

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Passing file handle to compiler

Post 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
Make sure you have read the HOW TO POST thread
Action
CodeLite Enthusiast
Posts: 13
Joined: Fri Nov 21, 2008 12:51 pm
Contact:

Re: Passing file handle to compiler

Post 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
Post Reply