Thread: [Dev-C++] Reading GCC output
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Brian C. B. <bcb...@ya...> - 2001-06-18 16:04:26
|
Hi,
I am trying to read the output of the gcc compiler like Bloodshed Dev-C++
does and am not being successful. I tried looking in the online gcc manual
for command line options that might direct the output into a file, but did
not find such an option. I also read that gcc uses temp files to communicate
between the compiler, assembler, linker, etc, but could not find any
information on how to find those files to read them. I also tried the using
the "-pipe" command and that did not work; I also tried the following code
to pipe the output into my program. It works for other console programs but
outputs garbage when I try to read the output of gcc (perhaps because gcc
calles other proccesses? ):
long i;
HANDLE rh;
HANDLE wh;
STARTUPINFO stinfo;
PROCESS_INFORMATION pinfo;
DWORD bytesread;
char buf[65536];
SECURITY_ATTRIBUTES sattr;
akostring output;
HANDLE oldwh;
ZeroMemory(&sattr, sizeof(SECURITY_ATTRIBUTES));
sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
sattr.lpSecurityDescriptor = 0;
sattr.bInheritHandle = true;
CreatePipe(&rh, &wh, &sattr, 0);
oldwh = GetStdHandle(STD_OUTPUT_HANDLE);
SetStdHandle(STD_OUTPUT_HANDLE, wh);
ZeroMemory(&stinfo, sizeof(STARTUPINFO));
stinfo.cb = sizeof(STARTUPINFO);
stinfo.lpReserved = 0;
stinfo.lpReserved2 = 0;
stinfo.cbReserved2 = 0 ;
stinfo.lpDesktop = 0;
stinfo.lpTitle = 0;
stinfo.dwFlags = STARTF_USESHOWWINDOW;
stinfo.wShowWindow = SW_HIDE;
if(!CreateProcess(0, "C:\\WINDOWS\\TEMP\\AkoClass\\compiler\\bin\\g++
\"C:\\WINDOWS\\TEMP\\AKOCLASS\\OUTPUT.cpp\" -c -s -mwindows -O1 -O3 -fexpens
ive-optimizations -IC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\ -IC:\\W
INDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\G__~1 -IC:\\WINDOWS\\TEMP\\AkoCla
ss\\compiler\\INCLUDE\\ -LC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\LIB\\ -BC:\
\WINDOWS\\TEMP\\AkoClass\\compiler\\BIN", 0, 0, false, CREATE_NEW_CONSOLE |
NORMAL_PRIORITY_CLASS, 0,0, &stinfo, &pinfo)){
MessageBox(0,"Error","Failed",0);
}
else{
WaitForSingleObject(pinfo.hProcess, INFINITE );
CloseHandle(wh);
SetStdHandle(STD_OUTPUT_HANDLE, oldwh);
output = "";
ReadFile(rh, &buf, 65536, &bytesread, NULL);
output = (char*) &buf;
CloseHandle(pinfo.hProcess);
CloseHandle( pinfo.hThread );
}
//Note: akostring is a string class.
// output now contains garbage or nothing
Could anybody help me with this problem? Thanks in advance.
Sincerely,
Brian
"Shall we accept good from God, and not trouble?" Job 2:10
---
Outgoing mail is certified Virus Free by AVG
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
|
|
From: Steve D. P. <ste...@ho...> - 2001-06-18 17:13:35
|
Umm... write a program called 'foo.cpp', compile it to form =
'foo.exe', go to a command-prompt and type:
c:\YourDir\foo.exe > YourOutputFile.txt
"Piping" isn't something you do at compile-time, it's something you =
do at run-time... to direct an application's input and/or output to or =
from a location other than it was coded for at compile-time.
Cheers,
Steve
----- Original Message -----=20
From: Brian C. Becker=20
To: devcpp=20
Sent: Monday, June 18, 2001 12:03 PM
Subject: [Dev-C++] Reading GCC output
Hi,
I am trying to read the output of the gcc compiler like Bloodshed =
Dev-C++ does and am not being successful. I tried looking in the online =
gcc manual for command line options that might direct the output into a =
file, but did not find such an option. I also read that gcc uses temp =
files to communicate between the compiler, assembler, linker, etc, but =
could not find any information on how to find those files to read them. =
I also tried the using the "-pipe" command and that did not work; I =
also tried the following code to pipe the output into my program. It =
works for other console programs but outputs garbage when I try to read =
the output of gcc (perhaps because gcc calles other proccesses? ):
long i;
HANDLE rh;
HANDLE wh;
STARTUPINFO stinfo;
PROCESS_INFORMATION pinfo;
DWORD bytesread;
char buf[65536];
SECURITY_ATTRIBUTES sattr;
akostring output;
HANDLE oldwh;
ZeroMemory(&sattr, sizeof(SECURITY_ATTRIBUTES));
sattr.nLength =3D sizeof(SECURITY_ATTRIBUTES);
sattr.lpSecurityDescriptor =3D 0;
sattr.bInheritHandle =3D true;
CreatePipe(&rh, &wh, &sattr, 0);
oldwh =3D GetStdHandle(STD_OUTPUT_HANDLE);
SetStdHandle(STD_OUTPUT_HANDLE, wh);
ZeroMemory(&stinfo, sizeof(STARTUPINFO));
stinfo.cb =3D sizeof(STARTUPINFO);
stinfo.lpReserved =3D 0;
stinfo.lpReserved2 =3D 0;
stinfo.cbReserved2 =3D 0 ;
stinfo.lpDesktop =3D 0;
stinfo.lpTitle =3D 0;
stinfo.dwFlags =3D STARTF_USESHOWWINDOW;
stinfo.wShowWindow =3D SW_HIDE;
if(!CreateProcess(0, "C:\\WINDOWS\\TEMP\\AkoClass\\compiler\\bin\\g++ =
\"C:\\WINDOWS\\TEMP\\AKOCLASS\\OUTPUT.cpp\" -c -s -mwindows -O1 -O3 =
-fexpensive-optimizations =
-IC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\ =
-IC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\G__~1 =
-IC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\ =
-LC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\LIB\\ =
-BC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\BIN", 0, 0, false, =
CREATE_NEW_CONSOLE | NORMAL_PRIORITY_CLASS, 0,0, &stinfo, &pinfo)){
MessageBox(0,"Error","Failed",0);
}
else{
WaitForSingleObject(pinfo.hProcess, INFINITE );
CloseHandle(wh);
SetStdHandle(STD_OUTPUT_HANDLE, oldwh);
output =3D "";
ReadFile(rh, &buf, 65536, &bytesread, NULL);
output =3D (char*) &buf;
CloseHandle(pinfo.hProcess);
CloseHandle( pinfo.hThread );
}
//Note: akostring is a string class.
// output now contains garbage or nothing
Could anybody help me with this problem? Thanks in advance.
Sincerely,
Brian
"Shall we accept good from God, and not trouble?" Job 2:10
|
|
From: Brian C. B. <bcb...@ya...> - 2001-06-18 20:10:57
|
Hi,
I apologize for not being clear. I am coding a small IDE that invokes the
GCC compiler, just like Dev-C++ does. Dev-C++ catches the output produced by
GCC and displays the errors, warnings, and other GCC output at the bottom of
the program. I would like to know how to do just that: invoke GCC from my
program, catch the output, and display it. I know how to invoke GCC and
display any output, but I do not know how to catch the output. Could someone
point me in the right direction? Thanks in advance.
Sincerely,
Brian
"Shall we accept good from God, and not trouble?" Job 2:10
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Steve D.
Perkins
Sent: Monday, June 18, 2001 1:10 PM
To: dev...@li...
Subject: Re: [Dev-C++] Reading GCC output
Umm... write a program called 'foo.cpp', compile it to form 'foo.exe',
go to a command-prompt and type:
c:\YourDir\foo.exe > YourOutputFile.txt
"Piping" isn't something you do at compile-time, it's something you do
at run-time... to direct an application's input and/or output to or from a
location other than it was coded for at compile-time.
Cheers,
Steve
----- Original Message -----
From: Brian C. Becker
To: devcpp
Sent: Monday, June 18, 2001 12:03 PM
Subject: [Dev-C++] Reading GCC output
Hi,
I am trying to read the output of the gcc compiler like Bloodshed
Dev-C++ does and am not being successful. I tried looking in the online gcc
manual for command line options that might direct the output into a file,
but did not find such an option. I also read that gcc uses temp files to
communicate between the compiler, assembler, linker, etc, but could not find
any information on how to find those files to read them. I also tried the
using the "-pipe" command and that did not work; I also tried the following
code to pipe the output into my program. It works for other console programs
but outputs garbage when I try to read the output of gcc (perhaps because
gcc calles other proccesses? ):
long i;
HANDLE rh;
HANDLE wh;
STARTUPINFO stinfo;
PROCESS_INFORMATION pinfo;
DWORD bytesread;
char buf[65536];
SECURITY_ATTRIBUTES sattr;
akostring output;
HANDLE oldwh;
ZeroMemory(&sattr, sizeof(SECURITY_ATTRIBUTES));
sattr.nLength = sizeof(SECURITY_ATTRIBUTES);
sattr.lpSecurityDescriptor = 0;
sattr.bInheritHandle = true;
CreatePipe(&rh, &wh, &sattr, 0);
oldwh = GetStdHandle(STD_OUTPUT_HANDLE);
SetStdHandle(STD_OUTPUT_HANDLE, wh);
ZeroMemory(&stinfo, sizeof(STARTUPINFO));
stinfo.cb = sizeof(STARTUPINFO);
stinfo.lpReserved = 0;
stinfo.lpReserved2 = 0;
stinfo.cbReserved2 = 0 ;
stinfo.lpDesktop = 0;
stinfo.lpTitle = 0;
stinfo.dwFlags = STARTF_USESHOWWINDOW;
stinfo.wShowWindow = SW_HIDE;
if(!CreateProcess(0, "C:\\WINDOWS\\TEMP\\AkoClass\\compiler\\bin\\g++
\"C:\\WINDOWS\\TEMP\\AKOCLASS\\OUTPUT.cpp\" -c -s -mwindows -O1 -O3 -fexpens
ive-optimizations -IC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\ -IC:\\W
INDOWS\\TEMP\\AkoClass\\compiler\\INCLUDE\\G__~1 -IC:\\WINDOWS\\TEMP\\AkoCla
ss\\compiler\\INCLUDE\\ -LC:\\WINDOWS\\TEMP\\AkoClass\\compiler\\LIB\\ -BC:\
\WINDOWS\\TEMP\\AkoClass\\compiler\\BIN", 0, 0, false, CREATE_NEW_CONSOLE |
NORMAL_PRIORITY_CLASS, 0,0, &stinfo, &pinfo)){
MessageBox(0,"Error","Failed",0);
}
else{
WaitForSingleObject(pinfo.hProcess, INFINITE );
CloseHandle(wh);
SetStdHandle(STD_OUTPUT_HANDLE, oldwh);
output = "";
ReadFile(rh, &buf, 65536, &bytesread, NULL);
output = (char*) &buf;
CloseHandle(pinfo.hProcess);
CloseHandle( pinfo.hThread );
}
//Note: akostring is a string class.
// output now contains garbage or nothing
Could anybody help me with this problem? Thanks in advance.
Sincerely,
Brian
"Shall we accept good from God, and not trouble?" Job 2:10
---
Outgoing mail is certified Virus Free by AVG
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
|
|
From: Elias P. <eli...@ao...> - 2001-06-18 21:17:27
|
> I apologize for not being clear. I am coding a small IDE that invokes the GCC compiler, just
> like Dev-C++ does. Dev-C++ catches the output produced by GCC and displays the errors,
> warnings, and other GCC output at the bottom of the program. I would like to know how to do
> just that: invoke GCC from my program, catch the output, and display it. I know how to invoke
> GCC and display any output, but I do not know how to catch the output. Could someone point me
> in the right direction? Thanks in advance.
Hi, i don't know why the source code you posted doesn't work. I'm using basically the same code in my programs. The program below works fine for me under win98, i'm using the code to catch output for another program, but it seems to work with 'gcc' just the same.
I didn't look at your code in detail, but it's almost the same procedure:
Cerate a temporary file, redirect the output from the called command into that file, then read the contents of the temporary file and delete the file.
I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should of course work with a dev-c++ project as well.
(Warning: This code may contain all sort of mistakes and bugs)(but i hope it does work)
Elias Pschernig
-- catch.c
#include <windows.h>
void execute(char *command) {
char tempdir[1024];
char tempfile[1024];
STARTUPINFO sui;
PROCESS_INFORMATION pi;
HANDLE capture;
GetTempPath(1024, tempdir);
GetTempFileName(tempdir, "bla", 0, tempfile);
capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
memset(&sui,0,sizeof sui);
sui.cb = sizeof sui;
sui.lpTitle = "my redir";
sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
sui.hStdOutput = capture;
sui.hStdError = capture;
sui.hStdInput = NULL;
sui.wShowWindow = SW_HIDE;
if(CreateProcess(NULL, command,
NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) {
char *buffer;
DWORD size;
WaitForSingleObject(pi.hProcess, INFINITE);
SetFilePointer(capture, 0, NULL, FILE_BEGIN);
size = GetFileSize(capture, NULL);
buffer = alloca(size+1);
ReadFile(capture, buffer, size, &size, NULL);
buffer[size] = 0;
CloseHandle(capture);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
DeleteFile(tempfile);
MessageBox(NULL,buffer,"Captured Output",MB_OK);
} else {
MessageBox(NULL,command,"Error: Could not execute",MB_OK);
}
}
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
execute("gcc -v");
return 0;
}
|
|
From: Brian C. B. <bcb...@ya...> - 2001-06-19 11:26:13
|
Hi,
Thank you for this code, it appears to work correctly with GCC.
Sincerely,
Brian
"Shall we accept good from God, and not trouble?" Job 2:10
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...]On Behalf Of Elias
Pschernig
Sent: Monday, June 18, 2001 5:17 PM
To: dev...@li...
Subject: Re: [Dev-C++] Reading GCC output
> I apologize for not being clear. I am coding a small IDE that invokes
the GCC compiler, just
> like Dev-C++ does. Dev-C++ catches the output produced by GCC and displays
the errors,
> warnings, and other GCC output at the bottom of the program. I would like
to know how to do
> just that: invoke GCC from my program, catch the output, and display it. I
know how to invoke
> GCC and display any output, but I do not know how to catch the output.
Could someone point me
> in the right direction? Thanks in advance.
Hi, i don't know why the source code you posted doesn't work. I'm using
basically the same code in my programs. The program below works fine for me
under win98, i'm using the code to catch output for another program, but it
seems to work with 'gcc' just the same.
I didn't look at your code in detail, but it's almost the same procedure:
Cerate a temporary file, redirect the output from the called command into
that file, then read the contents of the temporary file and delete the file.
I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should of
course work with a dev-c++ project as well.
(Warning: This code may contain all sort of mistakes and bugs)(but i hope it
does work)
Elias Pschernig
-- catch.c
#include <windows.h>
void execute(char *command) {
char tempdir[1024];
char tempfile[1024];
STARTUPINFO sui;
PROCESS_INFORMATION pi;
HANDLE capture;
GetTempPath(1024, tempdir);
GetTempFileName(tempdir, "bla", 0, tempfile);
capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL,
CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
memset(&sui,0,sizeof sui);
sui.cb = sizeof sui;
sui.lpTitle = "my redir";
sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
sui.hStdOutput = capture;
sui.hStdError = capture;
sui.hStdInput = NULL;
sui.wShowWindow = SW_HIDE;
if(CreateProcess(NULL, command,
NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) {
char *buffer;
DWORD size;
WaitForSingleObject(pi.hProcess, INFINITE);
SetFilePointer(capture, 0, NULL, FILE_BEGIN);
size = GetFileSize(capture, NULL);
buffer = alloca(size+1);
ReadFile(capture, buffer, size, &size, NULL);
buffer[size] = 0;
CloseHandle(capture);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
DeleteFile(tempfile);
MessageBox(NULL,buffer,"Captured Output",MB_OK);
} else {
MessageBox(NULL,command,"Error: Could not execute",MB_OK);
}
}
int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
execute("gcc -v");
return 0;
}
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
---
Incoming mail is certified Virus Free by AVG
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
---
Outgoing mail is certified Virus Free by AVG
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
NetZero Platinum
No Banner Ads and Unlimited Access
Sign Up Today - Only $9.95 per month!
http://www.netzero.net
|
|
From: Johannes P. <joh...@pr...> - 2001-06-19 15:57:02
|
Hi there
------------
Sorry for sending to your personal mail. but I have trouble sending to the
DevCpp list. it something (well most of the times) reject my mail.
Also I want to ask if this IDE that you are planning to code. Will be
compiler specific. For (exept for WinEdit) I am looking for a
IDE that can use almost any compiler. Like Borland C++ 5.
Well just wanted to ask considering I cant get onto the DevCpp list to ask
this Question..
Thanks for your time and sorry for mailing your private..
Johannes Pretorius
At 07:25 19/06/2001 -0400, you wrote:
>Hi,
>Thank you for this code, it appears to work correctly with GCC.
>
>Sincerely,
>Brian
>
>"Shall we accept good from God, and not trouble?" Job 2:10
>-----Original Message-----
>From: dev...@li...
>[mailto:dev...@li...]On Behalf Of Elias
>Pschernig
>Sent: Monday, June 18, 2001 5:17 PM
>To: dev...@li...
>Subject: Re: [Dev-C++] Reading GCC output
>
>
> > I apologize for not being clear. I am coding a small IDE that invokes
>the GCC compiler, just
> > like Dev-C++ does. Dev-C++ catches the output produced by GCC and displays
>the errors,
> > warnings, and other GCC output at the bottom of the program. I would like
>to know how to do
> > just that: invoke GCC from my program, catch the output, and display it. I
>know how to invoke
> > GCC and display any output, but I do not know how to catch the output.
>Could someone point me
> > in the right direction? Thanks in advance.
>
>Hi, i don't know why the source code you posted doesn't work. I'm using
>basically the same code in my programs. The program below works fine for me
>under win98, i'm using the code to catch output for another program, but it
>seems to work with 'gcc' just the same.
>
>I didn't look at your code in detail, but it's almost the same procedure:
>
>Cerate a temporary file, redirect the output from the called command into
>that file, then read the contents of the temporary file and delete the file.
>
>I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should of
>course work with a dev-c++ project as well.
>
>(Warning: This code may contain all sort of mistakes and bugs)(but i hope it
>does work)
>
>Elias Pschernig
>
>-- catch.c
>#include <windows.h>
>
>void execute(char *command) {
> char tempdir[1024];
> char tempfile[1024];
> STARTUPINFO sui;
> PROCESS_INFORMATION pi;
> HANDLE capture;
>
> GetTempPath(1024, tempdir);
> GetTempFileName(tempdir, "bla", 0, tempfile);
>
> capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL,
> CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
>
> memset(&sui,0,sizeof sui);
>
> sui.cb = sizeof sui;
> sui.lpTitle = "my redir";
> sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
> sui.hStdOutput = capture;
> sui.hStdError = capture;
> sui.hStdInput = NULL;
> sui.wShowWindow = SW_HIDE;
>
> if(CreateProcess(NULL, command,
> NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) {
>
> char *buffer;
> DWORD size;
>
> WaitForSingleObject(pi.hProcess, INFINITE);
>
> SetFilePointer(capture, 0, NULL, FILE_BEGIN);
> size = GetFileSize(capture, NULL);
> buffer = alloca(size+1);
>
> ReadFile(capture, buffer, size, &size, NULL);
> buffer[size] = 0;
>
> CloseHandle(capture);
>
> CloseHandle(pi.hThread);
> CloseHandle(pi.hProcess);
>
> DeleteFile(tempfile);
>
> MessageBox(NULL,buffer,"Captured Output",MB_OK);
>
> } else {
> MessageBox(NULL,command,"Error: Could not execute",MB_OK);
> }
>
>}
>
>int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
> execute("gcc -v");
> return 0;
>}
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>---
>Incoming mail is certified Virus Free by AVG
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
>
>---
>Outgoing mail is certified Virus Free by AVG
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
>
>
>NetZero Platinum
>No Banner Ads and Unlimited Access
>Sign Up Today - Only $9.95 per month!
>http://www.netzero.net
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|
|
From: Ioannis V. <no...@ya...> - 2001-06-19 20:49:34
|
Well, congratulations. You found your way to the mailing list.
Ioannis
----- Original Message -----
From: "Johannes Pretorius" <joh...@pr...>
To: <dev...@li...>
Sent: Tuesday, June 19, 2001 7:06 PM
Subject: RE: [Dev-C++] Reading GCC output
> Hi there
> ------------
>
> Sorry for sending to your personal mail. but I have trouble sending to the
> DevCpp list. it something (well most of the times) reject my mail.
> Also I want to ask if this IDE that you are planning to code. Will be
> compiler specific. For (exept for WinEdit) I am looking for a
> IDE that can use almost any compiler. Like Borland C++ 5.
>
> Well just wanted to ask considering I cant get onto the DevCpp list to ask
> this Question..
>
> Thanks for your time and sorry for mailing your private..
>
> Johannes Pretorius
>
>
>
> At 07:25 19/06/2001 -0400, you wrote:
> >Hi,
> >Thank you for this code, it appears to work correctly with GCC.
> >
> >Sincerely,
> >Brian
> >
> >"Shall we accept good from God, and not trouble?" Job 2:10
> >-----Original Message-----
> >From: dev...@li...
> >[mailto:dev...@li...]On Behalf Of Elias
> >Pschernig
> >Sent: Monday, June 18, 2001 5:17 PM
> >To: dev...@li...
> >Subject: Re: [Dev-C++] Reading GCC output
> >
> >
> > > I apologize for not being clear. I am coding a small IDE that
invokes
> >the GCC compiler, just
> > > like Dev-C++ does. Dev-C++ catches the output produced by GCC and
displays
> >the errors,
> > > warnings, and other GCC output at the bottom of the program. I would
like
> >to know how to do
> > > just that: invoke GCC from my program, catch the output, and display
it. I
> >know how to invoke
> > > GCC and display any output, but I do not know how to catch the output.
> >Could someone point me
> > > in the right direction? Thanks in advance.
> >
> >Hi, i don't know why the source code you posted doesn't work. I'm using
> >basically the same code in my programs. The program below works fine for
me
> >under win98, i'm using the code to catch output for another program, but
it
> >seems to work with 'gcc' just the same.
> >
> >I didn't look at your code in detail, but it's almost the same procedure:
> >
> >Cerate a temporary file, redirect the output from the called command into
> >that file, then read the contents of the temporary file and delete the
file.
> >
> >I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should
of
> >course work with a dev-c++ project as well.
> >
> >(Warning: This code may contain all sort of mistakes and bugs)(but i hope
it
> >does work)
> >
> >Elias Pschernig
> >
> >-- catch.c
> >#include <windows.h>
> >
> >void execute(char *command) {
> > char tempdir[1024];
> > char tempfile[1024];
> > STARTUPINFO sui;
> > PROCESS_INFORMATION pi;
> > HANDLE capture;
> >
> > GetTempPath(1024, tempdir);
> > GetTempFileName(tempdir, "bla", 0, tempfile);
> >
> > capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL,
> > CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL);
> >
> > memset(&sui,0,sizeof sui);
> >
> > sui.cb = sizeof sui;
> > sui.lpTitle = "my redir";
> > sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
> > sui.hStdOutput = capture;
> > sui.hStdError = capture;
> > sui.hStdInput = NULL;
> > sui.wShowWindow = SW_HIDE;
> >
> > if(CreateProcess(NULL, command,
> > NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) {
> >
> > char *buffer;
> > DWORD size;
> >
> > WaitForSingleObject(pi.hProcess, INFINITE);
> >
> > SetFilePointer(capture, 0, NULL, FILE_BEGIN);
> > size = GetFileSize(capture, NULL);
> > buffer = alloca(size+1);
> >
> > ReadFile(capture, buffer, size, &size, NULL);
> > buffer[size] = 0;
> >
> > CloseHandle(capture);
> >
> > CloseHandle(pi.hThread);
> > CloseHandle(pi.hProcess);
> >
> > DeleteFile(tempfile);
> >
> > MessageBox(NULL,buffer,"Captured Output",MB_OK);
> >
> > } else {
> > MessageBox(NULL,command,"Error: Could not execute",MB_OK);
> > }
> >
> >}
> >
> >int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) {
> > execute("gcc -v");
> > return 0;
> >}
> >
> >
> >_______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
> >---
> >Incoming mail is certified Virus Free by AVG
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
> >
> >---
> >Outgoing mail is certified Virus Free by AVG
> >Checked by AVG anti-virus system (http://www.grisoft.com).
> >Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001
> >
> >
> >NetZero Platinum
> >No Banner Ads and Unlimited Access
> >Sign Up Today - Only $9.95 per month!
> >http://www.netzero.net
> >
> >_______________________________________________
> >Dev-cpp-users mailing list
> >Dev...@li...
> >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
>
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> http://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
|
|
From: Brian C. B. <bcb...@ya...> - 2001-06-19 22:10:13
|
Hi, Don't worry about sending to my email address, that is perfectly alright. As for my IDE, it is extremely new and has very little functionality to offer at this time. I had planned to have it GCC specific because I am most familiar with GCC. I am not against including other compiler support if someone points out good reasons to include it. That said, you might want to check out the free V IDE available at http://www.objectcentral.com/vide.htm. It can use GCC, Borland C++ 5.5, or Sun JDK. Here is what it says "Supports development of both C/C++ with the GNU gcc/g++ compiler for MS-Windows and Linux, (OS/2 environment soon), as well as the Java development using the Sun JDK. Borland C++ Compiler 5.5 - VIDE has very good support for the free Borland command line compiler tools. It can build Console, GUI, and static library project files. It also includes some extra documentation about the Borland environment. VIDE also supports Borland's Turbo Debugger TD32." Email me if you have any other questions. Also, I can post a message to the DevCpp list concerning this topic (I am assuming you can recieve messages); email me with the message to post and I will post it. Sincerely, Brian "Shall we accept good from God, and not trouble?" Job 2:10 -----Original Message----- From: dev...@li... [mailto:dev...@li...]On Behalf Of Johannes Pretorius Sent: Tuesday, June 19, 2001 12:07 PM To: dev...@li... Subject: RE: [Dev-C++] Reading GCC output Hi there ------------ Sorry for sending to your personal mail. but I have trouble sending to the DevCpp list. it something (well most of the times) reject my mail. Also I want to ask if this IDE that you are planning to code. Will be compiler specific. For (exept for WinEdit) I am looking for a IDE that can use almost any compiler. Like Borland C++ 5. Well just wanted to ask considering I cant get onto the DevCpp list to ask this Question.. Thanks for your time and sorry for mailing your private.. Johannes Pretorius At 07:25 19/06/2001 -0400, you wrote: >Hi, >Thank you for this code, it appears to work correctly with GCC. > >Sincerely, >Brian > >"Shall we accept good from God, and not trouble?" Job 2:10 >-----Original Message----- >From: dev...@li... >[mailto:dev...@li...]On Behalf Of Elias >Pschernig >Sent: Monday, June 18, 2001 5:17 PM >To: dev...@li... >Subject: Re: [Dev-C++] Reading GCC output > > > > I apologize for not being clear. I am coding a small IDE that invokes >the GCC compiler, just > > like Dev-C++ does. Dev-C++ catches the output produced by GCC and displays >the errors, > > warnings, and other GCC output at the bottom of the program. I would like >to know how to do > > just that: invoke GCC from my program, catch the output, and display it. I >know how to invoke > > GCC and display any output, but I do not know how to catch the output. >Could someone point me > > in the right direction? Thanks in advance. > >Hi, i don't know why the source code you posted doesn't work. I'm using >basically the same code in my programs. The program below works fine for me >under win98, i'm using the code to catch output for another program, but it >seems to work with 'gcc' just the same. > >I didn't look at your code in detail, but it's almost the same procedure: > >Cerate a temporary file, redirect the output from the called command into >that file, then read the contents of the temporary file and delete the file. > >I compiled with 'gcc -mwindows -O3 -s -o catch.exe catch.c', but should of >course work with a dev-c++ project as well. > >(Warning: This code may contain all sort of mistakes and bugs)(but i hope it >does work) > >Elias Pschernig > >-- catch.c >#include <windows.h> > >void execute(char *command) { > char tempdir[1024]; > char tempfile[1024]; > STARTUPINFO sui; > PROCESS_INFORMATION pi; > HANDLE capture; > > GetTempPath(1024, tempdir); > GetTempFileName(tempdir, "bla", 0, tempfile); > > capture=CreateFile(tempfile,GENERIC_READ|GENERIC_WRITE,0,NULL, > CREATE_ALWAYS,FILE_ATTRIBUTE_TEMPORARY,NULL); > > memset(&sui,0,sizeof sui); > > sui.cb = sizeof sui; > sui.lpTitle = "my redir"; > sui.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; > sui.hStdOutput = capture; > sui.hStdError = capture; > sui.hStdInput = NULL; > sui.wShowWindow = SW_HIDE; > > if(CreateProcess(NULL, command, > NULL, NULL, TRUE, 0, NULL, tempdir, &sui, &pi)) { > > char *buffer; > DWORD size; > > WaitForSingleObject(pi.hProcess, INFINITE); > > SetFilePointer(capture, 0, NULL, FILE_BEGIN); > size = GetFileSize(capture, NULL); > buffer = alloca(size+1); > > ReadFile(capture, buffer, size, &size, NULL); > buffer[size] = 0; > > CloseHandle(capture); > > CloseHandle(pi.hThread); > CloseHandle(pi.hProcess); > > DeleteFile(tempfile); > > MessageBox(NULL,buffer,"Captured Output",MB_OK); > > } else { > MessageBox(NULL,command,"Error: Could not execute",MB_OK); > } > >} > >int WINAPI WinMain(HINSTANCE hinst,HINSTANCE prev,LPSTR arg,int show) { > execute("gcc -v"); > return 0; >} > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users >--- >Incoming mail is certified Virus Free by AVG >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001 > >--- >Outgoing mail is certified Virus Free by AVG >Checked by AVG anti-virus system (http://www.grisoft.com). >Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001 > > >NetZero Platinum >No Banner Ads and Unlimited Access >Sign Up Today - Only $9.95 per month! >http://www.netzero.net > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users _______________________________________________ Dev-cpp-users mailing list Dev...@li... http://lists.sourceforge.net/lists/listinfo/dev-cpp-users --- Incoming mail is certified Virus Free by AVG Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001 --- Outgoing mail is certified Virus Free by AVG Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.256 / Virus Database: 129 - Release Date: 5/31/2001 NetZero Platinum No Banner Ads and Unlimited Access Sign Up Today - Only $9.95 per month! http://www.netzero.net |
|
From: Ioannis V. <no...@ya...> - 2001-06-19 22:48:44
|
There is the official release of GCC 3.0. Can we expect Dev-C++ with the mingw32 port anytime soon? Ioannis _________________________________________________________ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com |
|
From: Colin L. <web...@bl...> - 2001-06-20 14:08:47
|
Hi ! > There is the official release of GCC 3.0. Can we expect Dev-C++ with the > mingw32 port anytime soon? if the MIngw team make a new Mingw release with gcc 3.0 then i will probably do a new Dev-C++ version including GCC 3 during July. Greetings, Colin |