The MASM Forum

Miscellaneous => Miscellaneous Projects => Topic started by: herge on February 22, 2013, 02:24:07 AM

Title: Wind Chill Program C++
Post by: herge on February 22, 2013, 02:24:07 AM
 Hi Rubber Duck Fans:

Are we ready for some real chilly and cold math.
The government of USA (NOAA) supplied the formula
and the rest is just c++ it was original a Borland C program
but now works on c++ 2008 with a few additions.

// windchill.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
/* 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>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <conio.h>
  using std::cout;
  using std::endl;
  using std::setw;
  using std::endl;

int _tmain(int argc, _TCHAR* argv[])
    {
    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 = 1;
    cout << "MPH\tWind Chill Factor (Temperature +40" << char(k)
<<"F to -40" << char(k) << "F" << 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();
return 0;
}

  Expected output

MPH     Wind Chill Factor (Temperature +40°F to -40°F
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



Do NOT try to change the range of temperatures or wind speed
It will not work!
Getting the degee symbol to print was a real pain.

Regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 03:31:38 AM
@ herge , you seem to know C++
Can you get the about box and menus to work in this tutorial?

http://masm32.com/board/index.php?action=dlattach;topic=1402.0;attach=1250

I just got mad and did it in masm :)

Can you fix it?
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 03:50:08 AM
I tried compiling this but I get errors  :(

Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 04:46:22 AM

Hi hfheatherfox07:

You will get three warning messages but it should go.

1>Compiling...
1>stdafx.cpp
1>Compiling...
1>windchill.cpp
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\windchill\windchill\windchill.cpp(39) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\windchill\windchill\windchill.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data
1>c:\documents and settings\owner\my documents\visual studio 2008\projects\windchill\windchill\windchill.cpp(56) : warning C4996: 'getch': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _getch. See online help for details.
1>        c:\program files\microsoft visual studio 9.0\vc\include\conio.h(145) : see declaration of 'getch'
1>Compiling manifest to resources...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Linking...
1>LINK : C:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\windchill\Debug\windchill.exe not found or not built by the last incremental link; performing full link
1>Embedding manifest...
1>Microsoft (R) Windows (R) Resource Compiler Version 6.1.6723.1
1>Copyright (C) Microsoft Corporation.  All rights reserved.
1>Build log was saved at "file://c:\Documents and Settings\Owner\My Documents\Visual Studio 2008\Projects\windchill\windchill\Debug\BuildLog.htm"
1>windchill - 0 error(s), 3 warning(s)
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========



Regards herge

Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 05:05:46 AM

Hi heather:

you called stdafx twice?

Regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 05:17:49 AM
I am sorry I copied your source as you posted it, not compiling
Maybe you have different  stdafx.h ?
Why are you compiling stdafx.cpp ?



I have no idea what your answer was? :(
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 05:19:28 AM
Quote from: herge on February 22, 2013, 05:05:46 AM

Hi heather:

you called stdafx twice?

Regards herge


What are you talking about?
Sorry new to C++

EDIT:
Please take a look at the batch file that I use to complie !
I'm am not using visual studio 2008

Can you include all your includes?
Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 05:37:44 AM

hi heather:


C:\down\temp>dir
Volume in drive C has no label.
Volume Serial Number is E491-9F6C

Directory of C:\down\temp

02/21/2013  12:52 PM    <DIR>          .
02/21/2013  12:52 PM    <DIR>          ..
02/21/2013  12:50 PM    <DIR>          main 5-Resources Icons, Dialogs and Menu

02/21/2013  01:21 PM    <DIR>          Wind Chill Program C++
               0 File(s)              0 bytes
               4 Dir(s)  111,687,221,248 bytes free

C:\down\temp>cd ,\wind chill program c++
The system cannot find the path specified.

C:\down\temp>cd .\wind chill program c++

C:\down\temp\Wind Chill Program C++>dir
Volume in drive C has no label.
Volume Serial Number is E491-9F6C

Directory of C:\down\temp\Wind Chill Program C++

02/21/2013  01:21 PM    <DIR>          .
02/21/2013  01:21 PM    <DIR>          ..
02/21/2013  01:21 PM               551 Build it.bat
02/21/2013  12:59 PM               552 buildit.bat
02/21/2013  12:52 PM               551 buildit.txt
02/21/2013  12:58 PM               552 builit.bar.txt
02/21/2013  01:21 PM             1,059 StdAfx.h
02/21/2013  01:21 PM             1,729 windchill.cpp
               6 File(s)          4,994 bytes
               2 Dir(s)  111,687,221,248 bytes free

C:\down\temp\Wind Chill Program C++>build it
'build' is not recognized as an internal or external command,
operable program or batch file.

C:\down\temp\Wind Chill Program C++>"build it"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

cl : Command line warning D9002 : ignoring unknown option '/ML'
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(39) : warning C4244: '=' : conversion from 'double' to 'int', pos
ible loss of data
windchill.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', pos
ible loss of data
windchill.cpp(51) : warning C4310: cast truncates constant value
windchill.cpp(56) : warning C4996: 'getch': The POSIX name for this item is dep
ecated. Instead, use the ISO C++ conformant name: _getch. See online help for d
tails.
        C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\conio.h(145) :
ee declaration of 'getch'
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 5.12.8078
Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

Press any key to continue . . .
C:\down\temp\Wind Chill Program C++>dir
Volume in drive C has no label.
Volume Serial Number is E491-9F6C

Directory of C:\down\temp\Wind Chill Program C++

02/21/2013  01:27 PM    <DIR>          .
02/21/2013  01:27 PM    <DIR>          ..
02/21/2013  01:21 PM               551 Build it.bat
02/21/2013  12:59 PM               552 buildit.bat
02/21/2013  12:52 PM               551 buildit.txt
02/21/2013  12:58 PM               552 builit.bar.txt
02/21/2013  01:21 PM             1,059 StdAfx.h
02/21/2013  01:21 PM             1,729 windchill.cpp
02/21/2013  01:27 PM           162,816 windchill.exe
               7 File(s)        167,810 bytes
               2 Dir(s)  111,687,024,640 bytes free

C:\down\temp\Wind Chill Program C++>windchill
MPH     Wind Chill Factor (Temperature +40°F to -40°F
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

C:\down\temp\Wind Chill Program C++>

/code]

It works.

Do not put spaces in filnames because you
have to quote them i e
>"build it"

If you want Dos start vc and use tools command prompt
the tools is above vc click it and then click command prompt.

Regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 12:03:26 PM
I double click the batch file , that is all and it will NOT compile :(
And as for that other attachment I can not add about dialog , or menu to code
Dunno how with out error :(


Not opening any DOS command prompt ??
I have Microsoft SDK and Microsoft Visual C++ Toolkit 2003

not same includes as you !!!!
That is why I asked for them


I will stick to masm32
As long as you instal in C drive , a persons can download your asm source with a batch file and build an app, simple!

So much hassle with C and C ++
H
I have no idea what your answer was, I double click that batch file and it still won't compile ?
It's OK.........

Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 02:10:44 PM
 Hi DednDave:

If you got Microsoft vc 2008 or vc 2005 in Arixona down south try the
wind chill program  please,

Hi heather:

Dos does not like spaces in Filenames get use to it or
as I have said before quote it. i e
>"build it"
or to put iy another way dos stops at the space so it thinks it
is the second arguement when it is NOT.
If you DO NOT QUOTE it can not find the next arguement and
because if found the Space it think its got the arguement when
it only has half of it!

This is vc 2008 and it has different DLLs running
and is very difficult to run with out them.

I think you should try Borland 5.5 compiler and make sure you
get the .cfg files thal are short files. It's about 8 meg.
I can assure you will need the cfg files for Borland to go.

C:\borland\bcc55\bin>dir *.cfg
Volume in drive C has no label.
Volume Serial Number is E491-9F6C

Directory of C:\borland\bcc55\bin

07/15/2008  05:34 AM                60 bcc32.cfg
07/15/2008  05:45 AM                28 ilink.cfg
07/15/2008  05:57 AM                28 ilink32.cfg
               3 File(s)            116 bytes
               0 Dir(s)  111,672,188,928 bytes free



You won't actual find these files you have to create them
manually. But you will find imfomation at the down load site
as to what is in them.

Regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 04:45:47 PM
This are my errors

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(39) : warning C4244: '=' : conversion from 'double' to 'int', poss
ible loss of data
windchill.cpp(44) : error C2666: 'pow' : 7 overloads have similar conversions
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(620):
could be 'long double pow(long double,int)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(618):
or       'long double pow(long double,long double)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(572):
or       'float pow(float,int)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(570):
or       'float pow(float,float)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(534):
or       'double pow(int,int)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(532):
or       'double pow(double,int)'
        C:\Program Files\Microsoft Visual C++ Toolkit 2003\include\math.h(195):
or       'double pow(double,double)'
        while trying to match the argument list '(int, double)'
windchill.cpp(49) : warning C4244: '=' : conversion from 'double' to 'int', poss
ible loss of data
windchill.cpp(51) : warning C4310: cast truncates constant value
Press any key to continue . . .
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86
Copyright (C) Microsoft Corporation 1984-2002. All rights reserved.


also I need dacs4w32.lib 
Do you have?
Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 05:50:22 PM
 Hi Heather:

#include <cmath>
This should get rid of pow error I hope.

Note there is a c in front of math.
so it is cmath NOT math.

I do not have dacs4w32.lib on my
system so I can't give it to you.

Regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 05:58:18 PM
Quote from: herge on February 22, 2013, 05:50:22 PM

Hi Heather:

#include <cmath>
This should get rid of pow error I hope.

Regards herge

This is crazy ....
You have that in your original source
:dazzled:
Forget it I will stick to masm .....
Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 06:06:32 PM

Hi heather:

look at the very first entry and check the includes
cmath is there.

regards herge
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 06:26:11 PM
Quote from: herge on February 22, 2013, 06:06:32 PM

Hi heather:

look at the very first entry and check the includes
cmath is there.

regards herge

LOL
That what I was saying
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 07:17:31 PM
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/
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 22, 2013, 07:25:18 PM
As I said before I need to know what libs to link with , that is the issue !!!
In any case if you Google "windchill.cpp"
It seems to be some sort of popular assignment  :lol:

http://www.google.ca/#hl=en&sclient=psy-ab&q=windchill.cpp&oq=windchill.cpp&gs_l=serp.3...69457.69457.0.70556.1.1.0.0.0.0.0.0..0.0.les%3B..0.0...1c..4.psy-ab.m6eZX3kia_I&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=40da3377a7b91932&biw=1024&bih=608 (http://www.google.ca/#hl=en&sclient=psy-ab&q=windchill.cpp&oq=windchill.cpp&gs_l=serp.3...69457.69457.0.70556.1.1.0.0.0.0.0.0..0.0.les%3B..0.0...1c..4.psy-ab.m6eZX3kia_I&pbx=1&bav=on.2,or.r_gc.r_pw.r_qf.&fp=40da3377a7b91932&biw=1024&bih=608)
Title: Re: Wind Chill Program C++
Post by: dedndave on February 22, 2013, 07:38:16 PM
cpp = C++ = .NET = ewwwwww
Title: Re: Wind Chill Program C++
Post by: herge on February 22, 2013, 08:13:14 PM

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
Title: Re: Wind Chill Program C++
Post by: 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.
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 06:46:45 AM
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 . . .
Title: Re: Wind Chill Program C++
Post by: herge on February 23, 2013, 06:56:43 AM
 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
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 07:06:45 AM
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
Title: Re: Wind Chill Program C++
Post by: japheth on February 23, 2013, 07:15:00 AM
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.

Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 07:40:21 AM
@japheth I Get the same errors

I think I need msvcrt.lib  :t
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 08:05:31 AM
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:
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 08:13:06 AM
I like these example ... see the needed libs above  :biggrin:
Title: Re: Wind Chill Program C++
Post by: hfheatherfox07 on February 23, 2013, 08:30:30 AM
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
Title: Re: Wind Chill Program C++
Post by: herge on February 24, 2013, 04:51:52 PM

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