Bug 333563 - Compiling starter.exe having DEBUG_MONITOR defined fails when using Mingw/MSYS
Summary: Compiling starter.exe having DEBUG_MONITOR defined fails when using Mingw/MSYS
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows 7
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-05 07:56 EST by Raphael Zulliger CLA
Modified: 2020-09-04 15:21 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Raphael Zulliger CLA 2011-01-05 07:56:37 EST
Build Identifier: 20100617-1415

I've got Mingw/MSYS running on Windows 7 (64Bit) using gcc-4.5 and w32api-3.14.

I had to get some more information out from starter.exe to debug an issue. Therfore, I manually uncommented
  //#define DEBUG_MONITOR 
in starter.cpp. After that, compiling the sources failed (it perfectly worked before my change). I got the following failures (shortened):

  $ make
  g++ -DUNICODE    -c -o starter.o starter.cpp
  starter.cpp: In function 'int main()':
  starter.cpp:161:53: error: cannot convert 'const char*' to 'const WCHAR*' for argument '1' to 'void OutputDebugStringW(const WCHAR*)'
  ...

It seemed to me like a UNICODE issue. Therefore I started VC2008 and created a "new project" to see what compiler directives they use when compiling with UNICODE support. Among others, they pass the following directives to the compiler: 
  /D "_UNICODE" /D "UNICODE"
Because of that, my conclusion is that the makefile for starter.exe is missing the following additional directive:
  _UNICODE
(note the prefixed underscore). After having adjusted the makefile to
  CXXFLAGS = -DUNICODE -D_UNICODE
The compilation errors were gone (and, according to my tests) starter.exe worked like a charm!

As the fix is trivial, it could be worth the effort of doing it.

Reproducible: Always

Steps to Reproduce:
1. Prepare the environment described above
2. issue a 'make' in an msys console