Re: Compile from command line instead of inside Visual C++ 2005 Express Edition?
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Sun, 24 Dec 2006 00:19:15 -0500
See below...
On Sat, 23 Dec 2006 11:01:17 -0800, Susan Rice <srice1@xxxxxxx> wrote:
(I'm not sure if this is the best newsgroup to ask this question.****
Let me know if there's a more appropriate newsgroup to post this
question to. A lot of smart people in this newsgroup.)
I just finished installing Microsoft Visual C++ 2005 Express
Edition, and then installed the Microsoft Platform SDK, following
the instructions at:
http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/
and the test program compiles and runs fine when I open the
Visual C++ 2005 Express Edition program and compile within
the program.
Now my question is can I compile from the command line?
It should be obvious that you can, because you just did. THe errors have to do with
incorrect setup, not with compiling from the command line.
****
*****
I tried going to the directory where my test program "testsdk.cpp"
was and running the command:
cl.exe testsdk.cpp
and I got the following output:
--------(begin output)-----------
testsdk.cpp
NOTE: WINVER has been defined as 0x0500 or greater which enables
Windows NT 5.0 and Windows 98 features. When these headers were released,
Windows NT 5.0 beta 1 and Windows 98 beta 2.1 were the current versions.
For this release when WINVER is defined as 0x0500 or greater, you can only
build beta or test applications. To build a retail application,
set WINVER to 0x0400 or visit http://www.microsoft.com/msdn/sdk
to see if retail Windows NT 5.0 or Windows 98 headers are available.
See the SDK release notes for more information.
testsdk.cpp(149) : error C2664: 'DialogBoxParamA' : cannot convert
parameter 4 from 'long (struct HWND__ *,unsigned int,unsigned int,long)'
to 'int (__stdcall *)(struct HWND__ *,unsigned int,unsigned int,long)'
None of the functions with this name in scope match the target type
-------(end output)---------
WINVER enables new APIs, constants, etc. for the version of Windows.
So if you get messages like that, look for #pragma message(...) directives in the source
code.
Now the thing is that VS.NET 2005 is a whole lot fussier about C/C++ semantics than
previous editions. So if somebody did sloppy coding in some earlier version of a program,
the compiler is not going to be forgiving. In this case, the function given is not the
right prototype. So what you need to do is show us the ACTUAL CODE AT THAT POINT, and ALL
THE DECLARATIONS OF EVERY TYPE OR VARIABLE USED IN THE CALL! Then we can tell you
specifically what line is screwed up, but in this case, you should be able to read the
error message and fix the problem. The parameter is not correct, and you have to bring it
into compliance. Had you bothered to show the relevant code and declarations, we could
have told you what was wrong.
Parameter 4 has the wrong type. It should be to a function whose prototype is
BOOL CALLBACK functionname(HWND, UINT, WPARAM, LPARAM);
if it is anything else, then you will get the message shown. So fix it.
(One guess is that the code was compiled by default to use __stdcall linkage, which does
not excuse poor coding, because it should written to compile correctly no matter what the
default linkage type is)
joe
****
Joseph M. Newcomer [MVP]
So first I don't know anything about WINVER and what that warning
message is about, though I would eventually like to compile a
release version. And I don't know why it doesn't compile. Perhaps
there's a bunch of command line switches I'm supposed to add.
(The only thing I'm confident about is that I have no idea what
I'm doing... :)
I tried going to:
http://www.microsoft.com/msdn/sdk
but it just took me directly to:
http://msdn2.microsoft.com/en-us/default.aspx
-S.R.D.D.
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Prev by Date: Re: CArray Help!
- Next by Date: Re: Where do I ask questions about using Microsoft Visual C++ 2005 Express Edition?
- Previous by thread: moved to microsoft.public.vc.ide_general
- Next by thread: Where do I ask questions about using Microsoft Visual C++ 2005 Express Edition?
- Index(es):
Relevant Pages
|
Loading