Hey,
So I've got a question concerning printf(). In an attempt to gain a better understanding of OOP in Workbench 3.0, I found a snippet of code online and have been messing around with it. The only problem is that this particular code utilizes 'cout', unfortunately, I'm constrained to using 'printf()' with Workbench/VxWorks.
Normally this isn't a problem and I feel relatively comfortable using printf() instead of cout. BUT, I've never really dealt with return functions in conjunction with printf()--only voids--and I was hoping someone could help me or at least point me to the right website (all of the ones I've checked have just given me the standard '%' output methods.).
Below is the code, it is made up of a *.h header file and two *.cpp files. One as a main file and the other as a class definition file.
I believe my problem is at the bottom of the "cube.cpp" file:
Ah, of course... thank you Hammurabi! I was foolishly associating the 'd' in '%d' with double.
Switching over to '%f' allows it to Build with no errors or warnings. So that's great.
Unfortunately I am now coming up with linker issues:
Under Workbench I get:
Download completes with unresolved symbols reported!
Please resolve the following symbols before next download:
_Unwind_SjLj_Unregister
_Unwind_SjLj_Register
_Unwind_SjLj_Resume
__gxx_personality_sj0
So I went to try it in Microsoft Visual Studios 2005 (thinking maybe it was just Workbench being weird) and get 2 errors:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals
Ok, so I took out the destructor from "cube.h" and "cube.cpp" and it all works great in Workbench (building, linking, running, etc).. Microsoft Visual Studio still has problems with it though. The same as mentioned before:
error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartup
fatal error LNK1120: 1 unresolved externals
That's awesome. I keep forgetting to switch over my methods of naming initializer functons when going from Workbench to MVS (Workbench doesn't really like it when you use main). I really do appreciate both of your help!