Is that because standard C is used ?
Printable View
Is that because standard C is used ?
Well it doesnt compile correctly with that change but it does compile with a 'c' placed before the stdioQuote:
Originally posted by confuted
change
to thisCode:#include <stdio.h>
Code:#include <stdio>
using namespace std;
But I still get the error when linking:Code:#include <cstdio>
using namespace std;
Quote:
c:\windows\TEMP\ccDXufgb.o(.text+0x94):tictacto.cp p: undefined reference to `GetStockObject@4'
c:\windows\TEMP\ccDXufgb.o(.text+0x4d4):tictacto.c pp: undefined reference to `TextOutA@20'
c:\windows\TEMP\ccDXufgb.o(.text+0x4ee):tictacto.c pp: undefined reference to `TextOutA@20'
c:\windows\TEMP\ccDXufgb.o(.text+0x508):tictacto.c pp: undefined reference to `TextOutA@20'
c:\windows\TEMP\ccDXufgb.o(.text+0x525):tictacto.c pp: undefined reference to `TextOutA@20'
c:\windows\TEMP\ccDXufgb.o(.text+0x53f):tictacto.c pp: undefined reference to `TextOutA@20'
c:\windows\TEMP\ccDXufgb.o(.text+0x55c):tictacto.c pp: more undefined references to `TextOutA@20' follow
Maybe I havent set up my compiler correctly?
I need a 'compiler for dummies' version.:eek:
Have you read your compiler documentation? ;)
errrr...
You mean, read the instructions?
No, I pretty much just double clicked the installer and then started compiling. Ya think I mighta missd something?
Thanks for all your help!
I think its time to go read some more about my compiler... LOL!
Maybe I should download GLUT37 and start breaking that too...
:D
You should have a help file of some sort which will tell you how to use your compiler and linker. Read that ;) Although it appears that your compiler is kind of old if it won't accept #include <stdio>
#include <stdio> ?!?!
don't you mean #include <iostream>?
**edit***
for those "TextOut" etc. undefined references, are you including <windows.h>?
The help file is a little sparse on it too.
It was the first compiler that I could copy and paste code into and it worked.
I am basically finding code and seeing what I have to do to get it to compile. I would hate to learn enough C++ to write a large program and then have no way of running it because of compiler issues.
Now I need to learn more about compilers...
Ugh... I shoulda done this years ago... It's easier when the brain cells arent all fused together with complacency ... LOL
window.h is included
I added iostream.h
and I still get the errors...
I never said <iostream.h>, i said <iostream> <-notice no ".h"
If you're still having trouble post a zip file with your project as well as what compiler/OS you're using.
Here is the cpp I am trying to get to compile correctly on Dev-C++ (Version 4)
I teach medical instrumentation, so the homework I give out probably isn't of any use to you :PQuote:
Originally posted by Grumpy_Old_Man
[B]BTW CAT?
Do you have any homework online?
Perhaps you could throw in a link or two?
This is one of my 2 C++ references that I use all the time (the other being "The C++ Standard Library" by Josuttis). These books are excellent references, although I will admit I haven't used either while learning the language; I don't know how friendly relatively new programmers will find them. I don't think either is aimed at new programmers, actually. They're both books every serious programmer should eventually own, though.Quote:
The C++ Programming Language, Third Edition
by Bjarne Stroustrup
You can ignore the replies that mention source code changes (although they won't hurt and may well improve your readability/standards compliance). Your code compiles, but doesn't link: this suggests that you don't have or aren't linking the proper libraries. Errors in code or headers will show up as failed compilation, not typically failed linking.Quote:
LOL! The code now compiles with those changes, however [seems like there is always a 'however'] now when i go from the compiler to the linker I get this
Those all seem to be errors with linking WinAPI libraries; try to find a tutorial or such on compiling Win32 apps with your compiler, it will have to include that info.
be sure to include <windows.h> before any other include's. I have had this cause link errors before.
With the exception of having to change the second
toCode:for(u = blah,blah,blah
(because VC doens't allow redefinitions like that.)Code:for(uu = blah,blah,blah
it complied and ran fine with VC++ 6