Author Topic: No console window appears when I run a console application  (Read 32193 times)

Offline new_user

  • Single posting newcomer
  • *
  • Posts: 6
I am on windows.

The Hello World Console Application builds great but when I run there is no console window that comes up with output.

I am using cygwin gcc and gdb.

Thanks,
Scott

Offline new_user

  • Single posting newcomer
  • *
  • Posts: 6
Re: No console window appears when I run a console application
« Reply #1 on: May 11, 2008, 04:32:18 am »
More info -

I found the link
http://sourceforge.net/forum/forum.php?thread_id=1270028&forum_id=48211
by searching this forum.  I did the recommended steps including the last portion of the thread as quoted below

"My compiler is installed to D:\Dev-CPP. Therefore my GDB is in D:\dev-cpp. I created a file called gdb.ini and just put "set new-console on" in the file. Then in the program go to: Tools -> Compiler Options -> Programs. Then in the gdb.exe line put the following: gdb.exe --command=D:\Dev-Cpp\Bin\gdb.ini"

BTW - I was able to run the gdb exercise from the command line earlier where the console window flashed up for a moment and the author said I could go drink a beer because it would work.  No such luck.

I still have no console window when I run.

Is there a log file that can give me a clue?

Thanks,
Scott

Offline Deschamps

  • Multiple posting newcomer
  • *
  • Posts: 120
Re: No console window appears when I run a console application
« Reply #2 on: May 11, 2008, 12:24:51 pm »
Hello.

Have you tried calling your console app directly from the command line window? Or are you always executing your app from the C::B run option? Also, you could see your project properties (build targets tab) to ensure that "Pause when execution ends" option is checked for the desired target. It's possible that your app is running fine, but the console window closes quickly just after execution ends and you can't see it.

Regards.
Those who were seen dancing were thought to be insane by those who could not hear the music

Offline new_user

  • Single posting newcomer
  • *
  • Posts: 6
Re: No console window appears when I run a console application
« Reply #3 on: May 13, 2008, 06:39:24 pm »
Thanks Deschamps for your reply.  I execute my app from the C::B run option and "Pause when execution ends" is checked.

The Build log does not show any activity when I run so I am not sure why the console window doesn't come up.  I don't see a quick flash so I doubt that it's ever coming up.

Scott


Offline Drydive

  • Single posting newcomer
  • *
  • Posts: 7
Re: No console window appears when I run a console application
« Reply #4 on: June 13, 2008, 02:04:58 pm »
Well I found the same problem. I updated to Revision 5082. When running a simple "Hello World" program by using the run button of C:B
no console output appears.  When I debug the same program the console appears and runs as expected. "Pause when execution ends" is
checked in the build target options. 


Is this a bug of this revision? Any comments are welcome.

Thomas

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: No console window appears when I run a console application
« Reply #5 on: June 14, 2008, 12:44:54 am »
I confirm this bug on Linux (rev 5093 and the new 5095 both have the issue).
Running Build > Run causes a crash while running Debug > Start is OK with the same set of arguments.
End pause does not seem to be a factor.

Here might be a clue however: the "inner" console window that pops up after Build > Run displays a command line beginning with "sh: /tools/...(path to dir)"
While /...path to dir does exist, it is wrongly embedded under /tools/ by the sh command line.

Although I have not located this issue in the source code, admins should find the wrong line fast I think.

Fab

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No console window appears when I run a console application
« Reply #6 on: June 14, 2008, 11:02:37 am »
I can not confirm this, neither on windows (w2k) nor on linux (debian sid/experimental), both with svn r5095.

@ the linux-users: what is the content of the two text-boxes "Shell to run commands in" and "Terminal to launch console programs" in "Settings -> Environment... -> General settings" ?
If terminal is "xterm", is it really installed on your system ?

@ windows-users: which windows-version do you use ?
I had some strange issues on a panel-pc after upgrading it to XP SP3.

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: No console window appears when I run a console application
« Reply #7 on: June 14, 2008, 01:47:07 pm »
Hi Jens,
the requested parameters are respectively
/bin/sh -c
and
xterm -T $TITLE -e

Platform is Ubuntu hardy 8.04 with full update.

Note
-------
the Ubuntu xterm server had a bug which has been corrected today (do an apt-get update).
This bug is not related to the CB issue mentioned in this thread. However with this corrected xterm package a temporary turnaround can be devised as follows:
1)create a tool named "launch" in Tools>Configure Tools>Add
2)fill-in the executable line with /usr/bin/xterm
3)fill in the parameters line with:
 -e ${TARGET_OUTPUT_FILE} my command line
Users who have not updated their Ubuntu platform may experience a crash with this turnaround.


Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No console window appears when I run a console application
« Reply #8 on: June 14, 2008, 04:20:57 pm »
Hi Jens,
the requested parameters are respectively
/bin/sh -c
and
xterm -T $TITLE -e

Platform is Ubuntu hardy 8.04 with full update.

What's the output of Build Log ?

For me it's for example (on linux):
Code
Checking for existence: /tmp/test/bin/Release/test
Executing: xterm -T test -e /home/jens/codeblocks-build/codeblocks-1.0svn/src/output/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /tmp/test/bin/Release/test  (in /tmp/test/.)

and on W2K:
Code
Checking for existence: C:\new\test\bin\Release\test.exe
Executing: "C:\Programme\CodeBlocks/cb_console_runner.exe" "C:\new\test\bin\Release\test.exe"  (in C:\new\test\.)
« Last Edit: June 14, 2008, 04:26:43 pm by jens »

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: No console window appears when I run a console application
« Reply #9 on: June 14, 2008, 05:53:53 pm »
There's no such xterm test at configure stage (whether in my config.log or in configure screen output), despite the fact that xterm is installed and alway was.
So it might be an issue with the build process. See build output attached (boostrap, configure and start of make stage).
Best, Fab

[attachment deleted by admin]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No console window appears when I run a console application
« Reply #10 on: June 14, 2008, 06:36:18 pm »
There's no such xterm test at configure stage (whether in my config.log or in configure screen output), despite the fact that xterm is installed and alway was.
So it might be an issue with the build process. See build output attached (boostrap, configure and start of make stage).
Best, Fab

I don't mean the output of the codeblocks building process, but the one of the "Build Log" if I run the "Hellow world" sample created by the C::B wizard.

You run "./configure" with the parameter "--with-contrib=all".
The correct parameter is "--with-contrib-plugins=all". I wonder whay you don't see an error message like this one:
Code
configure: WARNING: Unrecognized options: --with-contrib
.

By the way how do you make gcc-4.3 compile C::B ? For me it does not work. If I have a clean source-tree it runs without errors, but lots of warnings, because of unsecure parentheses, but it does not build the executable "codeblocks" itself. If I run it a second teime I get a segfault.
I did not try this with "./configure,  make ...", but only with C::B itself, both as batch-build and from inside C::B.

I will try the "make"-method and see if it works.

EDIT:
works with gcc-4.3 and "make", so I guess it might be a problem with some build-options in C::B's project-file, that does not work correctly with 4.3.

By the way "xterm" is still working.
« Last Edit: June 14, 2008, 07:06:36 pm by jens »

Offline libfab

  • Multiple posting newcomer
  • *
  • Posts: 45
Re: No console window appears when I run a console application
« Reply #11 on: June 14, 2008, 07:26:10 pm »
Now I see what you mean with Build log!
Here its goes, as you'll see the paths are quite long and there's a couple of libs:

Checking for existence: /home/fab/Dev/software/DVD-Audio/DVD-Audio tools/dvda-author/dvda-author2008/dvda-auhor.2008.06.rc1/Code::Blocks_project/bin/Debug/dvda-author
Executing: /usr/bin/xterm  -e  /usr/local/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.:/home/fab/Dev/software/DVD-Audio/DVD-Audio tools/dvda-author/dvda-author2008/dvda-auhor.2008.06.rc1/lib:/home/fab/Dev/software/DVD-Audio/DVD-Audio tools/dvda-author/dvda-author2008/dvda-auhor.2008.06.rc1/Code::Blocks_project/c_utils /home/fab/Dev/software/DVD-Audio/DVD-Audio\ tools/dvda-author/dvda-author2008/dvda-auhor.2008.06.rc1/Code::Blocks_project/bin/Debug/dvda-author -l ~/log -P -o ~/DVD-AUDIO -i ~/Dev/software/DVD-Audio/soundfiles  -V ~/VIDEO_TS (in /home/fab/Dev/software/DVD-Audio/DVD-Audio tools/dvda-author/dvda-author2008/dvda-auhor.2008.06.rc1/Code::Blocks_project/.)


The console outputs :

sh: tools/dvda-author/dvda-author2008/.../lib:/home/fab/.../DVD-AUDIO: not found


which corresponds to the green 'subpath' chunk above.
So now at least there's a diagnosis: it's not a Ubuntu-related issue but a classic white-space-in-path issue while parsing the lib path command-line. Should be fairly easy to fix now.

I have OK console runs with a simpler project that does not have white spaces in paths.

As for ./configure --with-contrib(-plugins) I must have configured and built once with the correct command line, so now the plugins are there anyway? Looks like black magic, but anyway all plugins are there all-right.

Ubuntu 'make' tips:

I use the latest 4.3.1 (4.4.0 experimental is echoed by gcc --version) after compiling fresh gnu sources.
My advice would be to build gcc again freshly from sources as I did and start it all over with a clean svn trunk co.
I did not have a single log error except for run-of-the-mill warnings.
Note: do install GMP and MPFR with adequate versions. This anyway will be signalled by ./configure.
I have deep respect for the C::B build system, which is useful for most projects. However, goodol' autotools still hold the ground when it comes to checking a user's environment. My guess is that the C::B building process, when used with gcc, did not output the missing libs in your system file tree.

Best, Fab

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: No console window appears when I run a console application
« Reply #12 on: June 15, 2008, 01:19:29 pm »
@libfab:
I just posted a bug-report and a patch at berlios.
More in this thread: http://forums.codeblocks.org/index.php/topic,8607.msg62935.html#msg62935

It would be nice if you can try the patch and post if it works for you.
Please answer in the new thread.
.