PDA

Click to See Complete Forum and Search --> : Help with C


RaDIaToR52
April 16th, 2002, 11:31 PM
I am just getting started with C and have been doing some basic programs and such when today, we I tried to make a program expermenting with the float data type, I would get a error in debug referring to the header.

c:\program files\microsoft visual studio\teststido\teststido.cpp(12) : f

cruiouse, and unable to solve the problem, I tried other programs that included "printf" and the header stdio.h and all of the programs returned the same error on debug. Even code as simple as:

#include <stdio.h>

main()
{
printf ("lala.\n");
return ();
}

returns that error, I could use any help, thanks ^ ^

-Radiator52

RaDIaToR52
April 16th, 2002, 11:32 PM
Sorry.. the error message read:

c:\program files\microsoft visual studio\teststido\teststido.cpp(12) : fatal error C1010: unexpected end of file while looking for precompiled header directive

the_JinX
April 16th, 2002, 11:35 PM
it's

return 0;

not ();

RaDIaToR52
April 16th, 2002, 11:37 PM
Oh right, that was just a typo in the code, I still get the error message

the_JinX
April 16th, 2002, 11:43 PM
other possibility:

<stdio.h> is for c not c++ (cpp)

<iostream.h> is for c++

then it'd be

cout << "lala\n"

RaDIaToR52
April 16th, 2002, 11:47 PM
stdio.h used to work, now it suddenly just stoped working..and it says to use stdio.h in the manual i have
hm...

Cheeseball
April 16th, 2002, 11:49 PM
stdio.h is still aval in C++, and is probably not the problem. On the other hand you seem to have made the problem a LOT of new programmers make. Try your program like this, then compare it with what you had...>:)

#include <stdio.h>

int main(void) {

printf("Lala!\n");
return 0;

}

Cheeseball
April 16th, 2002, 11:51 PM
and I tested my code on Borland C++ 5.5.1 for Win32, Just thought I would mention this...:)

the_JinX
April 16th, 2002, 11:51 PM
how about:

int main(void)
{
//ur code here
}

RaDIaToR52
April 16th, 2002, 11:54 PM
Still nothing.. I thought maby stdio.h header file was deleated so I ran a search.. 3 found = \

<stdio.h> is for c not c++ (cpp)

C is what im trying to learn, not c++, incase there was a mis-communication :D

Cheeseball
April 16th, 2002, 11:57 PM
Did you copy paste the code I put in my previous post? Did it give the same error? Pipe the error thru a text file, (if you are using a command line compiler that is) by typing "compilecommand <file> > error.txt" and copy paste that into the forum.

Cheeseball
April 17th, 2002, 12:04 AM
admin please delete this post....:) Thanks

the_JinX
April 17th, 2002, 12:04 AM
if it is c not cpp then why does the error state

c:\program files\microsoft visual studio\teststido\teststido.cpp

??

and cheeseball's ver worked on my (gcc) compiler..

Cheeseball
April 17th, 2002, 12:04 AM
This one too...sorry for the triple post...:p

Kezil
April 17th, 2002, 12:06 AM
last resort: reinstall the compiler.

it seems that the compiler only includes C++ libraries, or it could be it was accidently(sp?) deleted or mangled. try inserting the disk, finding <stdio.h>, and then replacing the old one with it (or something like that).

Kezil
April 17th, 2002, 12:10 AM
it says "testsdio", I wonder why it isn't "teststdio"? and if it was a c header file, it should be .c like you said. maybe something else is trying to take it's place or the compiler has an error causing it to reference the wrong one.

the_JinX
April 17th, 2002, 12:13 AM
are u using visual c++ or something?

try borland or even better (in my taste) gcc

Cheeseball
April 17th, 2002, 01:45 AM
Sorry I posted my reply 3 times, apparently we had some network trouble on this side, or the site on that side decided to die with 5 people submitting a post on the same thread at the sametime...:)

RaDIaToR52
April 17th, 2002, 01:56 AM
well insteed of reinstalling, I did a system restore to 2 days ago, and it works now just peachy ^ ^. Don't know why what happened did, but hope it wont agian.
thanks eveyone for the help
-Radiator52