Skip to main content
gamedev.net
🔒 Locked

im almoast depressed

Started by atomic_west Dec 19, 2004 at 7:20 PM 36 replies 5.5k views
Original Post
atomic_west
atomic_west
i got some advice to get pithon to begin with but i cant get a good version of the installer i keep getting errors when i go to install it also i have a c++ compiler but it wont even compile hello world i keep getting funkey errors also is there any thing wrong with this code?? #include main() { printf("Hello World\n"); } i get multiple errors with this what the heck is going on??
mike25025
mike25025
#include
int main()
{
printf("Hello World\n");
return 0;
}
Saandman
Saandman
#include <stdlib.h>void main(){   printf("Hello World\n");}
________pro.gram.mer - an organism that turns caffeine into code
atomic_west
atomic_west
well i got [warning] in function 'int:
'printf'
each in a box down at the bottom for errors
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\Matt\Desktop\c projects\hello1.cpp" -o "C:\Documents and Settings\Matt\Desktop\c projects\hello1.exe" -fexceptions -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:/Documents and Settings/Matt/Desktop/c projects/hello1.cpp: In function `int
and that in the compiler log
Ra
Ra
You might be getting a warning for using old C headers in C++...

This should give you 0 warnings:

#include <iostream>int main(void){	std::cout << "Hello, world!\n";	std::cin.get(); /* keeps the console open until you hit a key */}
Ra
atomic_west
atomic_west
ok that one worked but it was the hedder?
any good c books or toutorials for beginners? that you know of??
Ra
Ra
Well he _is_ using a C++ compiler and stated he was using C++ in the OP, so I just assumed so. C code is compiled with gcc, not g++.
Ra
Fruny
Fruny
And main() always return int, never void anyway.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Zahlman
Zahlman
Quote:
Original post by atomic_west
well i got [warning] in function 'int:
'printf'
each in a box down at the bottom for errors
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\Matt\Desktop\c projects\hello1.cpp" -o "C:\Documents and Settings\Matt\Desktop\c projects\hello1.exe" -fexceptions -g3 -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:/Documents and Settings/Matt/Desktop/c projects/hello1.cpp: In function `int
and that in the compiler log


That isn't the whole error message. It continues on the next line, or something.

For heaven's sake, stick with Python. If you're running any vaguely recent version of Windows, and this direct link straight from python.org doesn't result in a perfectly straightforward install, then something is seriously odd about your system...
Ainokea
Ainokea
#include <cstdio>int main(){    printf("Hello World \n");}


______________With the flesh of a cow.
eleusive
eleusive
In C, you should have return 0 at the end of main. However in C++, if the main function returns nothing, a return value of 0 is assumed and the compiler takes care of the rest for you.
"What are you trying to tell me? That I can write an O(N^2) recursive solution for a 2-dimensional knapsack?" "No, programmer. I'm trying to tell you that when you're ready, you won't have to." -Adapted from "The Matrix"
eleusive
eleusive
Quote:
Original post by Emmanuel Deloget
Hi,

Quote:
Original post by Ra
You might be getting a warning for using old C headers in C++...
This should give you 0 warnings:
*** Source Snippet Removed ***


Well, there is no return in your function :(

Regards,


If you read my above post, you will see why there doesn't need to be a return value...
"What are you trying to tell me? That I can write an O(N^2) recursive solution for a 2-dimensional knapsack?" "No, programmer. I'm trying to tell you that when you're ready, you won't have to." -Adapted from "The Matrix"
Emmanuel Deloget
Emmanuel Deloget
Quote:
Original post by eleusive
Quote:
Original post by Emmanuel Deloget

Well, there is no return in your function :(

Regards,


If you read my above post, you will see why there doesn't need to be a return value...


My bad. Just give me the time to read the standard again. Yes, you are right (of course). < joke > Thus, this is valid but bad programming :) < / joke >

Yours,
ukdeveloper
ukdeveloper
Personally, I'd try:

#include <stdio.h>void main(){printf("Hello World\n");return 0;}


Or, in C++,

#include <iostream.h>int main(){cout<<"Hello World\n";return 0;}


Rob Loach
Rob Loach
Quote:
Original post by ukdeveloper
#include <iostream.h>

#include <iostream>
[wink]...You may also want to use the std namespace.
Rob Loach [Website] [Projects] [
Jingo
Jingo
In standard C and C++, main() is required to specify an int return type, it is not implied. In C and C++ there is an implicit return 0 at the end of main(). A fully conforming hello world in C++ is:

#include<iostream>#include<ostream>int main(){  std::cout << "Hello World" << std::endl;}
bit64
bit64
I think this thread has gone astray of being any help to the OP. I really don't think anyone needs to see another hello world program.

I'm not trying to be an ass, its just that the OP's question was answered already and people are arguing over the proper syntax of return statements, streams, input params etc. Starting to look more like a pissing contest, and if the OP wants to post another question they will need to read through all of this crap.
Don't be afraid to be yourself. Nobody else ever will be.
Oluseyi
Oluseyi
And people wonder why few games get made around here...

(Yes, this is part of my continuing derision of C and C++.)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.