Project

General

Profile

Actions

Support #4983

closed

Error in compilation of 3.3.5_rc2 for Mingw32/windows7

Added by Julien Ladge almost 8 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
Start date:
06/15/2016
Due date:
% Done:

0%

Estimated time:

Description

Hi,

I would like to compile Wt 3.3.5 rc2 on a windows 7 desktop with mingw32 (from Qt 5.6, mingw32 4.9.2)

I compiled Boost 1.61 but Wt cannot compile with these errors: (cmake is 3.5.0)

[  2%] Building CXX object src/CMakeFiles/wt.dir/Wt/Utils.obj
In file included from D:\tools\exec\MainQt\Wt\wt-3.3.5-rc2\src\Wt\Utils.C:17:0:
D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/winsock2.h:15:2: warning: #warning Please include winsock2.h before windows.h [-Wcpp]
 #warning Please include winsock2.h before windows.h
  ^
[  3%] Building CXX object src/CMakeFiles/wt.dir/Wt/WAbstractArea.obj
.. blabla ..
[ 17%] Building CXX object src/CMakeFiles/wt.dir/Wt/WGLWidget.obj
In file included from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/_mingw.h:12:0,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/crtdefs.h:10,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/wchar.h:9,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/c++/cwchar:44,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/c++/bits/postypes.h:40,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/c++/bits/char_traits.h:40,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/c++/string:40,
                 from D:/tools/exec/MainQt/Tools/mingw492_32/i686-w64-mingw32/include/c++/bitset:47,
                 from D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WWebWidget:11,
                 from D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WInteractWidget:10,
                 from D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget:10,
                 from D:\tools\exec\MainQt\Wt\wt-3.3.5-rc2\src\Wt\WGLWidget.C:7:
D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget:801:5: error: expected identifier before numeric constant
     NO_ERROR                       = 0x0,
     ^
D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget:801:5: error: expected '}' before numeric constant
D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget:801:5: error: expected unqualified-id before numeric constant
In file included from D:\tools\exec\MainQt\Wt\wt-3.3.5-rc2\src\Wt\WGLWidget.C:7:0:
D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget: In member function 'bool Wt::WGLWidget::restoringContext() const':
D:/tools/exec/MainQt/Wt/wt-3.3.5-rc2/src/Wt/WGLWidget:681:42: error: 'restoringContext_' was not declared in this scope
   bool restoringContext() const { return restoringContext_; }

And many errors follow.

I tried to add "-std=c++11" for WT_CPP_11_MODE but that do nothing.

Do you know what to do?

Actions #1

Updated by Wim Dumon almost 8 years ago

Hey,

Could this be caused by an unexpected #include <windows.h>? windows.h unfortunately sets a whole lot of defines that don't play together with other software.

You can try to define WIN32_LEAN_AND_MEAN in your project, or add some other defines that may reduce the amount of definitions that is set by windows.h.

Best regards,

Wim.

Actions #2

Updated by Julien Ladge almost 8 years ago

I used this code just before the enum in WGLWidget file to check if NO_ERROR was defined and what was its value :

#define VALUE_TO_STRING(x) #x
#define VALUE(x) VALUE_TO_STRING(x)
#define VAR_NAME_VALUE(var) #var "="  VALUE(var)
#ifdef NO_ERROR
#pragma message(VAR_NAME_VALUE(NO_ERROR))
#else
#pragma message("Empty constant")
#endif

I get NO_ERROR=01

Do you know how to retrieve the location of a defined constant?

I added -DWIN32_LEAN_AND_MEAN in the CMAKE_CXX_FLAGS variable and the first warning desappear. But errors are still here and I don't know what other defines will remove the NO_ERROR (and others) defines without doing a trial-and-error process

Actions #3

Updated by Wim Dumon almost 8 years ago

  • Status changed from New to Feedback

Try to simlpy define it again? I believe gcc will tell you where it was defined before, and possibly the complete path of include files that lead to the inclusion of that file (but I'm not sure).

So: #define NO_ERROR 02

Wim.

Actions #4

Updated by Julien Ladge almost 8 years ago

I added #undef NO_ERROR in ifdef and the compilation has been fine. So it's just this variable that is in conflict with the windows headers.

Actions #5

Updated by Koen Deforche over 7 years ago

  • Assignee set to Wim Dumon
Actions #6

Updated by Wim Dumon over 7 years ago

  • Status changed from Feedback to Closed

Ideal resolution is to find out what includes windows.h in a header file, and fix that header file so that it no longer needs that include. Probably caused by some #ifdef construction in a boost header file, but that's just a guess. If the header file would be included within Wt, I would consider that a bug in Wt.

Wim.

Actions

Also available in: Atom PDF