It appears you have not yet registered with our community. To register please click here.

Origin XT RPG Network Home

Clearly, I fail at life


Sep 12 2007, 12:29 AM (Post #1)
Here for the cute boys ;)
* * * * * * * * *
Posts: 16,853
Cash: 9,337,572 / 95,912
Group: Nobility
Joined: 5/08/05 04:11 AM
I can't even code hello world in C.

CODE
#include < stdio.h>

void main()
{
printf("\nHello World\n");
}


I get this when I type into the Konsole on Fedora...

QUOTE
[alqian@localhost Documents]$ gcc hello2.c -o hello
hello2.c:1:20: error:� stdio.h: No such file or directory
hello2.c: In function ‘main’:
hello2.c:5: warning: incompatible implicit declaration of built-in function ‘printf’
hello2.c:4: warning: return type of ‘main’ is not ‘int’
hello2.c:6:2: warning: no newline at end of file
Post Options

2 Pages  1 2 > 
Sep 12 2007, 12:32 AM (Post #2)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
QUOTE (钱丰雨 @ Sep 11 2007, 05:29 PM)
I can't even code hello world in C.

CODE
#include < stdio.h>

void main()
{
printf("\nHello World\n");
}


I get this when I type into the Konsole on Fedora...
*


No space in <>.

Also, why are you printing \ns?
Post Options

Sep 12 2007, 12:35 AM (Post #3)
Here for the cute boys ;)
* * * * * * * * *
Posts: 16,853
Cash: 9,337,572 / 95,912
Group: Nobility
Joined: 5/08/05 04:11 AM
I am going from this site: http://www.physics.drexel.edu/courses/Comp...c_tutorial.html

Ok so now...

CODE
#include <stdio.h>

void main()
{
printf("\nHello World\n");
}


Which leads to...


QUOTE
[alqian@localhost Documents]$ gcc hello2.c -o hello
hello2.c: In function ‘main’:
hello2.c:4: warning: return type of ‘main’ is not ‘int’
hello2.c:6:2: warning: no newline at end of file


Post Options

Sep 12 2007, 01:56 AM (Post #4)
Love me like you mean it
* * * * * * * *
Posts: 7,514
Cash: 660,127 / 5,875
Group: Nobility
Joined: 10/09/03 06:37 AM
You fail at life, Al? I don't even know what you're talking about... -_- *sulks away*
Post Options

Sep 12 2007, 02:18 AM (Post #5)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
QUOTE (钱丰雨 @ Sep 11 2007, 05:35 PM)
I am going from this site:  http://www.physics.drexel.edu/courses/Comp...c_tutorial.html

Ok so now...

CODE
#include <stdio.h>

void main()
{
printf("\nHello World\n");
}


Which leads to...
*


Um, maybe you need to convert it to int. int main() and be sure to return an int.
Post Options

Sep 12 2007, 03:27 AM (Post #6)
Nutricious Banana
* * * *
Posts: 738
Cash: 44,948 / 68,948
Group: Citizen
Joined: 8/13/07 06:56 PM
Wow, I have no idea how to fix that and I learned some C++ in 6th grade. T.T
Post Options

Sep 12 2007, 03:37 AM (Post #7)
Happy cow. It's what's for dinner.
* * * * * * *
Posts: 4,873
Cash: 59,400 / 10,338,526
Group: Cabinet Member
Joined: 10/03/03 02:54 AM
Hey printf! I remember that! And uh not all that much else. FROWN.GIF
Post Options

Sep 12 2007, 03:44 AM (Post #8)
Here for the cute boys ;)
* * * * * * * * *
Posts: 16,853
Cash: 9,337,572 / 95,912
Group: Nobility
Joined: 5/08/05 04:11 AM
Yeah, I got it to work now.
Post Options

Sep 12 2007, 04:22 AM (Post #9)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
QUOTE (钱丰雨 @ Sep 11 2007, 08:44 PM)
Yeah, I got it to work now.
*


What did you do to fix it?
Post Options

Sep 12 2007, 04:32 AM (Post #10)
Here for the cute boys ;)
* * * * * * * * *
Posts: 16,853
Cash: 9,337,572 / 95,912
Group: Nobility
Joined: 5/08/05 04:11 AM
void ---> int

and I added another line below the last "}"
Post Options

Sep 12 2007, 04:43 AM (Post #11)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
Okay, so basically what I said? sbiggrin.gif
Post Options

Sep 12 2007, 04:45 AM (Post #12)
Here for the cute boys ;)
* * * * * * * * *
Posts: 16,853
Cash: 9,337,572 / 95,912
Group: Nobility
Joined: 5/08/05 04:11 AM
Sure, I guess.
Post Options

Sep 12 2007, 05:07 AM (Post #13)
Foot Soldier
* * * * * * *
Posts: 4,711
Cash: 88,767 / 0
Group: Nobility
Joined: 5/04/04 11:36 PM
Coding is magic.
Post Options

Sep 23 2007, 03:51 AM (Post #14)
Well why can't we do the shuffle?!
* * * * * *
Posts: 1,679
Cash: 183,455 / 0
Group: Nobility
Joined: 7/12/03 08:49 PM
CODE

#include <iostream>
using namespace std;

int main()
{

cout<<"Hello, world!"<<endl;
return 0;
}



That's how I get it done in C++ anyways. I do not think that they have namespaces in C though, so it might be something like this:

CODE

#include <iostream>

int main()
{
std::cout<<"Hello, world!"<<endl;
return 0;

}



I've never used regular C before, so I do not know if they have the same libraries or not.
Post Options

Sep 23 2007, 04:09 AM (Post #15)
Not Odd anymore
* * * * * * * * * *
Posts: 45,875
Cash: 1,915,578 / 1,817,041,051
Group: Administrator
Joined: 7/10/02 09:48 PM
Instead of <iostream> in C you use <stdio.h>
Post Options

2 Pages  1 2 >