News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

Wind Chill Program C++

Started by herge, February 22, 2013, 02:24:07 AM

Previous topic - Next topic

hfheatherfox07

I am having the same issue :
http://social.msdn.microsoft.com/Forums/hu-HU/vcgeneral/thread/adcca6aa-9fe4-4e51-988b-fca9d3b3e9c6

I need to know What libs to link with ???

http://binglongx.wordpress.com/tag/pragma-comment-lib/
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

dedndave


herge


Hi Heather:

You need either vc 2005 or vc 2008 to run the wind chill program.
and I suspect you can not find a reliable down load site for
vc 2005. I think vc 2008 is close to 400 mB.

It will be very difficult or impossible to do with your 2003 C compiler.
Try out Borland it's abcient and old but it does go.

My original Borland wind chill program for c.


/* WIND.CPP 11/20/2003 10:30
   Author: herge
   Location: Waterloo, Ontario, CANADA
   WWW.nws.NOAA.gov
   Wind Chill = 35.74 + 0.6215 * T - 35.75(V**0.16) +
   0.4275 * T(V**0.16)
   Where T = Degrees F and V = mph */
#include <iostream.h>
#include <iomanip.h>
#include <algorithm.h>
#include <math.h>
#include <conio.h>
  using std::cout;
  using std::endl;
  using std::setw;
int main()
    {
    int i = 0; /* t index(f)*/
    int j = 0; /* v index(m)*/
    const int k = 248; /* Degree Symbol */
    int w = 0; /* Temperature Degrees F */
    double v6 = 0; /* Miles ** 0.16*/
    double c = 40; /* initial t(F) */
    int d = 5; /* initial v (mph) */
    // double f = 0.6214015; /* 1km = as mil
    //     es */
    // double f = 1.6092655 /* 1mi = as km *
    //     /
    double f = 1;
    cout << "MPH\tWind Chill Factor (Temperature +40F to -40F)" << endl;
    cout << " V  ";
    for ( i = 0 ; i < 17; i ++)
    cout << setw(3) << ( 40 - ( i * 5 )) << " " ;
    cout << char(k) << "F" << endl;
    for ( i = 1; i < 13; i++ )
        { /* Velocity */
        d = i * 5.0 * f;
        cout << setw(3) << d << " ";
        /* MPH to power of (0.16) */
        /* for wind chill formula */
        /* calculate in outer loop*/
        v6 = pow(d, 0.16);
        for ( j = 0; j < 17; j++)
            { /* Temperature */
            c = 40 - (j * 5);
            w = 35.74 + 0.6215 * c - 35.75 * v6 +
            0.4275 * c * v6;
            cout << setw(3) << w << " ";
            if( j == 16) cout << char(k) << "F";
        }
        cout << endl;
    }
    cout << "MPH" << endl;
    getch();
}
/*

C:\borland\bcc55\bin>pause
Press any key to continue . . .
C:\borland\bcc55\bin>wind
MPH     Wind Chill Factor (Temperature +40F to -40F)
V   40  35  30  25  20  15  10   5   0  -5 -10 -15 -20 -25 -30 -35 -40 °F
  5  36  30  24  18  12   7   1  -4 -10 -16 -22 -28 -34 -39 -45 -51 -57 °F
10  33  27  21  15   8   2  -3  -9 -15 -22 -28 -34 -40 -46 -53 -59 -65 °F
15  31  25  19  12   6   0  -6 -12 -19 -25 -32 -38 -45 -51 -57 -64 -70 °F
20  30  23  17  10   4  -2  -8 -15 -21 -28 -35 -41 -48 -54 -61 -67 -74 °F
25  29  22  16   9   2  -4 -10 -17 -24 -30 -37 -44 -50 -57 -64 -70 -77 °F
30  28  21  14   8   1  -5 -12 -19 -25 -32 -39 -46 -53 -59 -66 -73 -80 °F
35  27  20  13   7   0  -6 -13 -20 -27 -34 -41 -48 -54 -61 -68 -75 -82 °F
40  26  19  13   6   0  -7 -14 -21 -28 -35 -42 -49 -56 -63 -70 -77 -84 °F
45  26  19  12   5  -1  -8 -15 -22 -29 -37 -44 -51 -58 -65 -72 -79 -86 °F
50  25  18  11   4  -2  -9 -16 -24 -31 -38 -45 -52 -59 -66 -73 -80 -87 °F
55  25  18  10   3  -3 -10 -17 -24 -32 -39 -46 -53 -60 -67 -75 -82 -89 °F
60  24  17  10   3  -4 -11 -18 -25 -33 -40 -47 -54 -61 -69 -76 -83 -90 °F
MPH
Last Line c:\borland\bcc55\bin\wind.cpp
*/



Regards herge
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.

japheth

Quote from: hfheatherfox07 on February 22, 2013, 04:45:47 PM
This are my errors

change 1 line:


    //int d = 5; /* initial v (mph) */
    double d = 5; /* initial v (mph) */


and vc2003 tk should compile and link it fine.

hfheatherfox07

Quote from: japheth on February 22, 2013, 08:14:28 PM
Quote from: hfheatherfox07 on February 22, 2013, 04:45:47 PM
This are my errors

change 1 line:


    //int d = 5; /* initial v (mph) */
    double d = 5; /* initial v (mph) */


and vc2003 tk should compile and link it fine.

Hello,
I asked what Lib to link with?????
I am missing some lib???

Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.

windChill.cpp
windchill.cpp(31) : warning C4310: cast truncates constant value
windchill.cpp(32) : warning C4310: cast truncates constant value
windchill.cpp(36) : warning C4310: cast truncates constant value
windchill.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', poss
ible loss of data
windchill.cpp(51) : warning C4310: cast truncates constant value
windchill.cpp(21) : warning C4100: 'argv' : unreferenced formal parameter
windchill.cpp(21) : warning C4100: 'argc' : unreferenced formal parameter
Press any key to continue . . .
Microsoft (R) Incremental Linker Version 7.10.3077
Copyright (C) Microsoft Corporation.  All rights reserved.

windChill.obj : error LNK2019: unresolved external symbol "public: void __thisca
ll std::locale::facet::_Register(void)" (?_Register@facet@locale@std@@QAEXXZ) re
ferenced in function "class std::num_put<char,class std::ostreambuf_iterator<cha
r,struct std::char_traits<char> > > const & __cdecl std::use_facet<class std::nu
m_put<char,class std::ostreambuf_iterator<char,struct std::char_traits<char> > >
>(class std::locale const &)" (??$use_facet@V?$num_put@DV?$ostreambuf_iterator@
DU?$char_traits@D@std@@@std@@@std@@@std@@YAABV?$num_put@DV?$ostreambuf_iterator@
DU?$char_traits@D@std@@@std@@@0@ABVlocale@0@@Z)
windChill.obj : error LNK2019: unresolved external symbol "public: class std::lo
cale::facet const * __thiscall std::locale::_Getfacet(unsigned int)const " (?_Ge
tfacet@locale@std@@QBEPBVfacet@12@I@Z) referenced in function "class std::num_pu
t<char,class std::ostreambuf_iterator<char,struct std::char_traits<char> > > con
st & __cdecl std::use_facet<class std::num_put<char,class std::ostreambuf_iterat
or<char,struct std::char_traits<char> > > >(class std::locale const &)" (??$use_
facet@V?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@@std
@@YAABV?$num_put@DV?$ostreambuf_iterator@DU?$char_traits@D@std@@@std@@@0@ABVloca
le@0@@Z)
windChill.obj : error LNK2019: unresolved external symbol "public: void __thisca
ll std::_String_base::_Xran(void)const " (?_Xran@_String_base@std@@QBEXXZ) refer
enced in function "public: class std::basic_string<char,struct std::char_traits<
char>,class std::allocator<char> > & __thiscall std::basic_string<char,struct st
d::char_traits<char>,class std::allocator<char> >::assign(class std::basic_strin
g<char,struct std::char_traits<char>,class std::allocator<char> > const &,unsign
ed int,unsigned int)" (?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocato
r@D@2@@std@@QAEAAV12@ABV12@II@Z)
windChill.obj : error LNK2019: unresolved external symbol "public: void __thisca
ll std::_String_base::_Xlen(void)const " (?_Xlen@_String_base@std@@QBEXXZ) refer
enced in function "protected: bool __thiscall std::basic_string<char,struct std:
:char_traits<char>,class std::allocator<char> >::_Grow(unsigned int,bool)" (?_Gr
ow@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@IAE_NI_N@Z)
windChill.exe : fatal error LNK1120: 4 unresolved externals
Press any key to continue . . .
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

herge

 Hi Heather:

You can either download Borland or VC 2008 but
I think Borland will be slightly faster option.
Unless Japeth has some other solution.

Regards herge
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.

hfheatherfox07

LOL
This is too funny
No need to download any more stuff ...missing lib that you have and can attach

read a gain

http://social.msdn.microsoft.com/Forums/en/vcgeneral/thread/adcca6aa-9fe4-4e51-988b-fca9d3b3e9c6
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

japheth

Quote from: hfheatherfox07 on February 23, 2013, 06:46:45 AM
Hello,
I asked what Lib to link with?????
I am missing some lib???

This is a simple Win32 console app - it doesn't need any sophisticated lib, AFAICS.

I used the VC 2003 Toolkit and the Win32 import libraries of an old Windows SDK ( from around 2003 ).

From the linker MAP file I see that the following libraries have been used:


libc.lib
libcp.lib
kernel32.lib


libc.lib and libcp.lib contain the C runtime modules if the module is statically linked - and kernel32.lib should be no problem as well.


hfheatherfox07

@japheth I Get the same errors

I think I need msvcrt.lib  :t
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

LOL
I was right ,I needed msvcrt.lib than I added /MD switch  :biggrin:
every winchill.cpp  example works now

Just add those 3 libs where ever you have your lib folder  :biggrin:
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

I like these example ... see the needed libs above  :biggrin:
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

hfheatherfox07

I always like it when people can read a thread in the masm32 forum and find a %100 solution ...
So if any body reads this thread here is what is needed:

Here is a working link for:  The Microsoft Visual C++ Toolkit 2003 If anybody wants it

http://kael.civfanatics.net/files/VCToolkitSetup.exe

And: Microsoft Platform SDK. For the windows.h and other includes and library's

http://kael.civfanatics.net/files/PSDK-x86.exe



Good Reading-
Procedure to install the free Microsoft Visual C++ Toolkit 2003:
http://root.cern.ch/root/Procedure/Procedure%20to%20install%20the%20free%20Microsoft%20Visual%20C.htm
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

herge


Hi Rubber Duck Fans:

You can change all setw(3) to setw(4) and drop the << " "
i e
cout << setw(3) << w << " ";
to
cout << setw(4) << w;

I never know high school Fortran could be so much fun.

Regards herge
Regards herge
Read "Slow Death by Rubber Duck"
for chemical Laughs.