Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Codewarrior Windows > Re: Winsock Con...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 282 of 318
Post > Topic >>

Re: Winsock Console App - How?

by MW Ron <mwron@[EMAIL PROTECTED] > Jun 21, 2005 at 12:02 PM

In article <1119289959.394932.111050@[EMAIL PROTECTED]
>,
 "Gary Rice" <grice@[EMAIL PROTECTED]
> wrote:

>I have a bit of source code that I created on a Sun Solaris box using
>gcc.
>
>I need to port the code to Win2k. I have an older version of
>CodeWarrior (CW/Pro 5).
>
>I've slogged through most of the porting issues associated with the
>code migration. But one BIG problem remains:
>The original code uses a traditional command line approach. That is, it
>is a faceless background app - meaning no windows.
>
>Yet I've found that CodeWarrior wants me to use a Windows stationary
>rather than a Console stationary as the project type.

CodeWarrior should let you use a Console Stationery in fact you should 
for command line tools.  Why do you think it "wants" you to use the GUI 
stationery?
>
>Using a Windows stationary project, I have to define the entry point as
>WinMain (and lose the argv, argc stuff) - along with dealing with a
>window in my app.
>
>Using a Console stationary project results in a ton of compilation
>errors down inside the Windows header files.
>
>What am I to do? Any ideas?

I need to know the errors you are getting.  is this C++ code if so this 
is an incompatibility with the Windows SDK and the ANSI C++ 

Win32 defines two macros called min and max (in windef.h); these can 
conflict with the ANSI C++  min and max template functions.  This 
happens if you #include windows.h and one of the ANSI C++ headers that 
declare or call the template min and max functions. 

However,  MS's  min/max can be disabled by putting the line 
#define NOMINMAX
 before the #include of windows.h. (the min and max macro definitions 
are enclosed in an #ifdef NOMINMAX block in windef.h).

Since the stationery uses precompiled headers you will need to change 
the .pch++ file and precompile the MSLHeaders again.

In the Windows precompiled headers project

Win32-x86 Support
   Headers
      Precompiled Headers
         Win32Headers.mcp

Open the .pch or .pch++ file and for example Win32Headers.pch

#pragma precompile_target "Win32Headers.mch"
// #pragma once on
#include "ansi_prefix.win32.h"
#include <windows.h>

change that to
#pragma precompile_target "Win32Headers.mch"
// #pragma once on
#include "ansi_prefix.win32.h"
#define NOMINMAX
#include <windows.h>


That is my guess but if that isn't it I need to know the exact errors 
listed.

Ron

-- 
Metrowerks Community Forum is a free online resource for developers 
to discuss CodeWarrior topics with other users and Metrowerks' staff
        --   http://www.metrowerks.com/community
 --

 Ron Liechty - MWRon@[EMAIL PROTECTED]
 - http://www.metrowerks.com




 2 Posts in Topic:
Winsock Console App - How?
"Gary Rice" <  2005-06-20 10:52:39 
Re: Winsock Console App - How?
MW Ron <mwron@[EMAIL P  2005-06-21 12:02:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat May 17 7:43:50 CDT 2008.