Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hello World Wont Work (((figure it out)))

Status
Not open for further replies.

RMG112

Technical User
Jan 14, 2002
17
US
Ok i am trying to get the hello world script to exicute and it wont. it keeps telling me there are errors, see if you can find the problem:

// Include files
#include <stdio.h>

// Aplication Initialization
int main ()
{
printf (&quot;hello, World!\n&quot;);
return 0;
}


this is what i got from a tutorial, i just dont understand why such a simple script wont work.
 
is this your first day in class, or are you just trolling??

tmoody
 
Let me answer your question with a question. Since the code snippet is syntactically and semantically correct, what errors would you expect??
 
I'm willing to bet that your include files are not correctly linked. Try changing this line:

#include <stdio.h>

to the actual path, and replace <> with &quot;&quot; eg...

#include &quot;C:\compiler\includes\stdio.h&quot;

Or better yet, read the help files that came with your compiler on how to link the includes, and libraries ;)

Good luck, Rob
&quot;Programming is like art...It makes me feel like chopping my ear off.&quot;

- Currently down
 
its telling me that in the Int Main line. that it is bad why
 
I am just trying to grasp programming skills and i have a freash mind
 
Did you make this a Win32 Console application? Can u copy/paste the exact error string you're getting?

~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
// Include files
#include &quot;C:\compiler\includes\stdio.h&quot;

// Aplication Initialization
int main ()
{
printf (&quot;hello, World!\n&quot;);
return 0;
}




--------------------Configuration: Quicksort - Win32 Debug--------------------
Compiling...
quicksort.cpp
c:\test7\quicksort\quicksort.cpp(2) : fatal error C1083: Cannot open include file: 'C:\compiler\includes\stdio.h': No such file or directory
Error executing cl.exe.
Creating browse info file...
BSCMAKE: error BK1506 : cannot open file '.\Debug\quicksort.sbr': No such file or directory
Error executing bscmake.exe.

Quicksort.exe - 2 error(s), 0 warning(s)





THere it tis smy good folks
 
// Include files
#include <stdio.h>

// Aplication Initialization
int main ()
{
printf (&quot;hello, World!\n&quot;);
return 0;
}
 
oh my...I didn't mean that path literally, (eg. means example). c:\compiler\includes\ should be replaced with the directory of where your include files are. Also, the debugger wasn't found, you can do one of 2 things...Find out why the debugger isn't found, and fix it. Or compile without invokeing the debugger....type whatever you type to compile with a -h after it for help, that should show how to dissable the debugger.

Rob
&quot;Programming is like art...It makes me feel like chopping my ear off.&quot;

- Currently down
 
What happens if you change ur #include statement to this?

#include &quot;stdio.h&quot;

If it's in quotes the compiler looks in the application path directory, then the windows system directory. #include <stdio.h> tells the compiler to look in the system directory only, and maybe it's not there on your machine. If you're still getting errors on the .sbr file, you might fix this by creating a new Win32 console app and copy/paste the code.

~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
I now have one error



--------------------Configuration: hello - Win32 Debug--------------------
Compiling...
quicksort..cpp
C:\test7\Quicksort\hello\quicksort..cpp(9) : fatal error C1004: unexpected end of file found
Error executing cl.exe.

hello.exe - 1 error(s), 0 warning(s)
 
// Include files
#include &quot;stdio.h&quot;

// Aplication Initialization
int main ()
{
printf (&quot;hello, World!\n&quot;);
return 0;

Heres the script
 
// Include files
#include &quot;stdio.h&quot;

// Aplication Initialization
int main ()
{
printf (&quot;hello, World!\n&quot;);
return 0;

} // Added this!

~Mike
Any man willing to sacrifice liberty for security deserves neither liberty nor security.

-Ben Franklin
 
Your the man, it worked thank you for solving my problem
 
well, if that's the exact script, you're missing a } at the end...otherwise, it looks like whatever text editor you're useing is inserting unwanted characters in there...try useing the dos command &quot;edit&quot;, if you have no other alternative. Retype the entire program in there, and try again. Rob
&quot;Programming is like art...It makes me feel like chopping my ear off.&quot;

- Currently down
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top