Getting error message in a file

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting error message in a file

Vincent Lesbros
Hi,

I am using MinGw to compile C language code generated from a Smalltalk application.
To run the compiler (and then the linker), I have to use a ShellExecute command from smalltalk.
If there is no error in C code, no problem. All works fine.
But, when there are errors, 
I dont know how I can get this errors back in the Smalltalk environment.

Is there options to the gcc compiler to write the compilation errors in a file ?

Thanks for help,
Happy 2-0-1-6.





------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Keith Marshall
On 27/12/15 19:06, Vincent Lesbros wrote:
> Is there options to the gcc compiler to write the compilation errors in a
> file ?

Use standard I/O redirection?

You need to capture the stderr stream from the GCC command process,
within the environment which invokes it; in your case, that would be the
Smalltalk development environment, which hopefully provides some
configuration option to do just that.

--
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Vincent Lesbros
I know, I have to get the stderr output,
But the interface, from Smalltalk to run a Windows command is through the ShellExecute method :
some thing like :

<C: unsigned int ShellExecuteW(
HWND hwnd,
LPCWSTR lpOperation,
LPCWSTR lpFile,
LPCWSTR lpParameters,
LPCWSTR lpDirectory,
int nShowCmd )>
For the lpOperation I use "open"
For the lpFile the path to the MinGW gcc compiler, (a NTFSFilename('c:\Program Files (x86)\CodeBlocks\MinGW\bin\g++.exe'))
in lpParameters, I put the file to compile or link, 
I can't see any way to get the stderr output ?

Is there an option to tell the compiler to send errors in a specified file in the command line ?



2015-12-27 20:38 GMT+01:00 Keith Marshall <[hidden email]>:
On 27/12/15 19:06, Vincent Lesbros wrote:
> Is there options to the gcc compiler to write the compilation errors in a
> file ?

Use standard I/O redirection?

You need to capture the stderr stream from the GCC command process,
within the environment which invokes it; in your case, that would be the
Smalltalk development environment, which hopefully provides some
configuration option to do just that.

--
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Eli Zaretskii
> Date: Sun, 27 Dec 2015 21:09:16 +0100
> From: Vincent Lesbros <[hidden email]>
>
> I know, I have to get the stderr output,
> But the interface, from Smalltalk to run a Windows command is through the
> ShellExecute method :
> some thing like :
>
> <C: unsigned int ShellExecuteW(
> HWND hwnd,
> LPCWSTR lpOperation,
> LPCWSTR lpFile,
> LPCWSTR lpParameters,
> LPCWSTR lpDirectory,
> int nShowCmd )>
> For the lpOperation I use "open"
> For the lpFile the path to the MinGW gcc compiler, (a NTFSFilename('c:\Program
> Files (x86)\CodeBlocks\MinGW\bin\g++.exe'))
> in lpParameters, I put the file to compile or link,
> I can't see any way to get the stderr output ?
>
> Is there an option to tell the compiler to send errors in a specified file in
> the command line ?

No, not AFAIK.  But you can write a batch file in which you invoke GCC
with stderr redirected via "2> FILE", and then invoke that batch file
via ShellExecuteW.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Vincent Lesbros
Ok, this is apparently the only way. 
Thanks !



2015-12-27 21:24 GMT+01:00 Eli Zaretskii <[hidden email]>:
> Date: Sun, 27 Dec 2015 21:09:16 +0100
> From: Vincent Lesbros <[hidden email]>
>
> I know, I have to get the stderr output,
> But the interface, from Smalltalk to run a Windows command is through the
> ShellExecute method :
> some thing like :
>
> <C: unsigned int ShellExecuteW(
> HWND hwnd,
> LPCWSTR lpOperation,
> LPCWSTR lpFile,
> LPCWSTR lpParameters,
> LPCWSTR lpDirectory,
> int nShowCmd )>
> For the lpOperation I use "open"
> For the lpFile the path to the MinGW gcc compiler, (a NTFSFilename('c:\Program
> Files (x86)\CodeBlocks\MinGW\bin\g++.exe'))
> in lpParameters, I put the file to compile or link,
> I can't see any way to get the stderr output ?
>
> Is there an option to tell the compiler to send errors in a specified file in
> the command line ?

No, not AFAIK.  But you can write a batch file in which you invoke GCC
with stderr redirected via "2> FILE", and then invoke that batch file
via ShellExecuteW.

------------------------------------------------------------------------------
_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Keith Marshall
[Please do not top post; it is considered rude here]

On 27/12/15 20:34, Vincent Lesbros wrote:
>>> Is there an option to tell the compiler to send errors in a
>>> specified file in the command line ?
>>
>> No, not AFAIK.  But you can write a batch file in which you invoke
>> GCC with stderr redirected via "2> FILE", and then invoke that
>> batch file via ShellExecuteW.
>
> Ok, this is apparently the only way.

It may be the simplest way, although some may consider it to be untidy.
Is it not possible to open(), or to popen(), an output stream in the
parent process, then bind it to STDERR_FILENO with dup2(), *before*
calling ShellExecuteW()? That's the normal (programmatic) way to set up
I/O redirection, and it is, after all, what the shell itself most likely
does, when it processes "2> FILE".

--
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe

signature.asc (853 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Getting error message in a file

Vincent Lesbros
I am sorry, I found a way to get the error stream directly from Smalltalk.
ShellExecuteW was the wrong way.
The interface to be used is: 

ExternalProcess
execute: command
arguments: (parameter array)
do: [:stdoutStream|  "stdout" ]
errorStreamDo: [:stderrStream | "stderr" ].

So, I can now get the errors directly.
Thanks for your replies.





2015-12-27 22:31 GMT+01:00 Keith Marshall <[hidden email]>:
[Please do not top post; it is considered rude here]

On 27/12/15 20:34, Vincent Lesbros wrote:
>>> Is there an option to tell the compiler to send errors in a
>>> specified file in the command line ?
>>
>> No, not AFAIK.  But you can write a batch file in which you invoke
>> GCC with stderr redirected via "2> FILE", and then invoke that
>> batch file via ShellExecuteW.
>
> Ok, this is apparently the only way.

It may be the simplest way, although some may consider it to be untidy.
Is it not possible to open(), or to popen(), an output stream in the
parent process, then bind it to STDERR_FILENO with dup2(), *before*
calling ShellExecuteW()? That's the normal (programmatic) way to set up
I/O redirection, and it is, after all, what the shell itself most likely
does, when it processes "2> FILE".

--
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe


------------------------------------------------------------------------------

_______________________________________________
MinGW-users mailing list
[hidden email]

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:[hidden email]?subject=unsubscribe