Hi All,
Why when I complile and run the following:
#include "stdio.h"
main(void)
{
printf("test test test\n");
}
do I get no output to the screen? If I run it in the ddd debugger I get the
'test test test' in the console window, but when I run it from an Xterm get
nothing. Im wondering if stdout is set to somewhere else, but how do I check
this?
Regards
Michael
May 30 '06
16 2841
Martin Jørgensen <un*********@sp am.jay.net> writes: Flash Gordon wrote: Michael wrote: -snip-
> Hi Vladimir, > > I just used: > gcc -g test.c -o test.exe > > I get no warnings or errors OK, first off you are not doing enough to get all the useful warnings. You should add -ansi -pedantic -Wall -O Possibly -W as well, depending on your preferences.
I couldn't find any information on -W. I thought -Wall was the highest warning level. What would -W do?
<OT>
"info gcc" should show you the documentation for gcc, including
descriptions of all the command-line options.
</OT>
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Clever Monkey <cl************ **@hotmail.com. invalid> writes: Michael wrote: I just used: gcc -g test.c -o test.exe Never name a test script or program "test" in any POSIX environment. The shell builtin will usually be found first, and your program will never be found.
Use "foo" for test programs. It's why the gods created that word.
<WAY_OT>
Better yet, never included "." (the current directory) in your $PATH.
If you want to execute a program in your current directory, always
type "./whatever".
</WAY_OT>
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Martin Jørgensen said: I couldn't find any information on -W. I thought -Wall was the highest warning level. What would -W do?
Not enough. Give yourself nightmares with -W -Wall -ansi -pedantic
-Wformat-nonliteral -Wcast-align -Wpointer-arith -Wbad-function-cast
-Wmissing-prototypes -Wstrict-prototypes -Wmissing-declarations -Winline
-Wundef -Wnested-externs -Wcast-qual -Wshadow -Wconversion -Wwrite-strings
-Wno-conversion -ffloat-store -O2
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
"Default User" <de***********@ yahoo.com> writes: Michael wrote:
Hi Vladimir,
I just used: gcc -g test.c -o test.exe
I get no warnings or errors
Thanks for your help.
Don't top-post. Your replies belong following or interspersed with the quotes.
As one person already mentioned, there is a progam called "test" on most UNIX systems. Also, if you're running from the CYGWIN shell you can't leave off the extension when you run it the way you can with Windows or DOS. That's why progams developed on UNIX systems tend not to have the .exe extension, as it doesn't mean (or do) anything special.
<WAY_OT>
Cygwin runs under Windows, so executables always have names ending in
".exe". You can omit the extension when you execute the program;
Cygwin does some magic to let you refer to the file as either "foo" or
"foo.exe". If there's a shell script called "foo" and an executable
called "foo.exe", it resolves the ambiguity in some manner that I
can't be bothered to remember.
</WAY_OT>
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Keith Thompson wrote: "Default User" <de***********@ yahoo.com> writes: As one person already mentioned, there is a progam called "test" on most UNIX systems. Also, if you're running from the CYGWIN shell you can't leave off the extension when you run it the way you can with Windows or DOS. That's why progams developed on UNIX systems tend not to have the .exe extension, as it doesn't mean (or do) anything special.
<WAY_OT> Cygwin runs under Windows, so executables always have names ending in ".exe". You can omit the extension when you execute the program; Cygwin does some magic to let you refer to the file as either "foo" or "foo.exe". If there's a shell script called "foo" and an executable called "foo.exe", it resolves the ambiguity in some manner that I can't be bothered to remember. </WAY_OT>
Ah. I thought it pretty much ran whatever shell it was, and the usual
Windows rules wouldn't come into play. I'm pretty sure it's at least
case-sensitive.
Brian
--
Please quote enough of the previous message for context. To do so from
Google, click "show options" and use the Reply shown in the expanded
header.
"Default User" <de***********@ yahoo.com> writes: [A cygwin question]
I'll reply to this by e-mail.
--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
"Flash Gordon" <sp**@flash-gordon.me.uk> wrote in message
news:ab******** ****@news.flash-gordon.me.uk... Michael wrote:
Your response belongs *under* the text you are replying to, after deleting bits you are not replying to, not above. I've corrected it this time.
"Vladimir Oka" <no****@btopenw orld.com> wrote in message news:11******** **************@ i40g2000cwc.goo glegroups.com.. . Michael wrote: Hi All,
Why when I complile and run the following:
#include "stdio.h" main(void) { printf("test test test\n"); }
do I get no output to the screen? If I run it in the ddd debugger I get the 'test test test' in the console window, but when I run it from an Xterm get nothing. Im wondering if stdout is set to somewhere else, but how do I check this? Your program should output "test test test" as you expect. The only problem you have is that pre-C99 you need to return something from `main()`. You don't tell what options you passed to your compiler and what warnings, if any, you get.
And, as you point out in another message, you should not use implicit int ;-)
Hi Vladimir,
I just used: gcc -g test.c -o test.exe
I get no warnings or errors
OK, first off you are not doing enough to get all the useful warnings. You should add -ansi -pedantic -Wall -O Possibly -W as well, depending on your preferences.
Secondly, under C89 the compiler is not required to complain about anything in your code (under C99, the latest standard not commonly implemented the compiler is required to complain about the implicit int), so the lack of warnings is not surprising.
<OT> bash has a built in command called test so it will be running that rather than your program. Just rename your program and it should work. </OT>
PS, OT means Off Topic, i.e. if you want to discuss bash and its built in test command further this is not the correct place. --
Thanks Guys, I knew it would be something really easy :-) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: dw |
last post by:
Pehaba,
does anyone knows how to install MySQLdb on cygwin?
- test device: MySQLdb 0.9.2.0 targz + cygwin
1.5.7-cr-0x9e + python
2.3.3 on cygwin + mysql
4.0.17 win32
- modified setup.py's using thread library.. NO,
library + include
|
by: Pekka Niiranen |
last post by:
Hi,
I started cygwin shell with command
subprocess.call("c:\\cygwin\\cygwin.bat")
from Python 2.4.
Shell works fine but the fonts/layout are
set according to program "c:\winnt\system32\cmd.exe".
|
by: JustSomeGuy |
last post by:
I'm writing a socket class using unix flavor sockets. I'm developing on
win2k with M$ visual studio 6.0.
I have cygwin installed and would like to use its socket header files:
#ifdef UNIX
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#else // Windows.
#include </cygwin/usr/include/sys/types.h>
|
by: alex |
last post by:
Hello
I have some c++ code, which has been happily developped in the
linux/unix world. Everything has always been compiled with different
compiler (intel, KAI, g++...) and gnu makefiles
For some obscure reasons, I have to make all this work in Windows,
where I have very little experience.
I've installed cygwin and everything is going well using the provided
g++ compiler.
|
by: rihad |
last post by:
Hi, I have this problem: when reading a M$ Windows text file under Windows in
text mode (fopen("blah", "r")) the Windows newline sequence, \r\n is returned as
is, i.e. it's not replaced by a single '\n'. Is this the correct behaviour? But
doesn't it make writing portable programs a bit harder? It would be nice if
whatever-newline-sequence-the-platform-has were replaced by a single \n, i.e.
the "C platform" line terminator. Like ints are...
| |
by: lcw1964 |
last post by:
Greetings, all,
I am trying to port a little bit of math code to gcc, that in the
original version used the long double version of several functions (in
particular, atanl, fabsl, and expl).
I get a complie-time "unidentified reference" error to the expl()
calls, but gcc seems to digest atanl and fabsl just fine. Changing expl
to exp cures the compile time problem, but I get at best double
precision in the final results. I am assuming...
|
by: dot |
last post by:
I spent a few headache filled days trying to use GMP on windows
(XP pro)
I finally got it to work and since I found little help on the Web
I thought someone might find what i did useful.
Creating an environment suitable for GMP programming.
1) Create 'cygwin' environment (see below)
2)add GMP to the cygwin directory (see below)
|
by: Gotch |
last post by:
Hi all,
I've installed the CDT plugin for Eclipse and I want to use it to work
on C/C++ projects under Cygwin. It works, in fact it compiles and runs
the usual helloworld c++ program. Now it comes difficult when I try to
add external libs. Such as... GTK. Let's explain what I tried. (oh
well, I'm using Eclipse Europa 3.3.1 and CDT 4.0.1). First I just
added the path of the cygwin includes throug the project->properties-
GNU C the path to...
|
by: myusernotyours |
last post by:
Hi All,
Am working on a Java application in which I have to use the JNI to Interface with some native code for both windows and unix. Am using netbeans IDE with the C/C++ pack installed. Am also using Cygwin as my compiler (gcc), this is ostensibly because I hope this compiler will also compile the unix native libraries since I don't have a Linux installation. (I am working on a personal project from the office and can't get linux installed)....
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |