Project

General

Profile

Typo in a header file?

Added by Vincenzo Romano over 5 years ago

I'm starting to move all my v3 code to v4.

A very simple test program is showing syntax errors in a header file.

Which I think is a bogus error hiding something else.

I attach my short code here.

The error message is:

[support@Feynman ~/wt/test] g++ -std=c++14 -Wall -c wttest.cpp 
In file included from /usr/include/Wt/WSignal.h:13,
                 from /usr/include/Wt/WWidget.h:14,
                 from /usr/include/Wt/WWebWidget.h:14,
                 from /usr/include/Wt/WBreak.h:10,
                 from /usr/include/Wt/WCssStyleSheet.h:14,
                 from /usr/include/Wt/WApplication.h:23,
                 from /usr/include/Wt/WServer.h:10,
                 from wttest.cpp:2:
/usr/include/Wt/Signals/signals.hpp: In static member function ‘static Wt::Signals::connection Wt::Signals::Impl::ConnectHelper<0, Args ...>::connect(Wt::Signals::Signal<Args ...>&, const Wt::Core::observable*, std::function<void()>&&)’:
/usr/include/Wt/Signals/signals.hpp:341:29: error: expected ‘,’ before ‘WT_CXX14ONLY’
     return signal.connect([f WT_CXX14ONLY(=std::move(f))](Args...) { f(); }, target);
                             ^~~~~~~~~~~~~
                             ,
/usr/include/Wt/Signals/signals.hpp:341:43: error: expected primary-expression before ‘=’ token
     return signal.connect([f WT_CXX14ONLY(=std::move(f))](Args...) { f(); }, target);
                                           ^

I am on ArchLinux, with its wt library "Version: 4.0.4-2".

gcc is "version 8.2.1 20180831 (GCC)" and my compilation command is g++ -std=c++14 -Wall -c wttest.cpp.

Any hint?


Replies (10)

RE: Typo in a header file? - Added by Roel Standaert over 5 years ago

I just tested compiling your file on Arch (a clean Docker container) with the same compiler and same version of Wt, and it succeeded. There must be something strange going on there.

It seems to me that it doesn't know of the WT_CXX14ONLY macro, although that is actually defined in Wt/WDllDefs.h.

RE: Typo in a header file? - Added by lm at over 5 years ago

I went ahead and gave it a go, too. I run arch linux daily. I saved wttest.cpp, and ran the command you gave: g++ -std=c++14 -Wall -c wttest.cpp, and got wttest.o. No output on standard output or standard error at all.

Maybe you have bad environment settings? Maybe there's something else in your process (Makefile involved?)?

RE: Typo in a header file? - Added by Vincenzo Romano over 5 years ago

For wt I have:

Repository      : community
Name            : wt
Version         : 4.0.4-2
Description     : a C++ library and application server for developing and deploying web applications
Architecture    : x86_64
URL             : http://www.webtoolkit.eu/
Licenses        : GPL
Groups          : None
Provides        : None
Depends On      : boost-libs  libharu  graphicsmagick  pango  zlib  libgl
Optional Deps   : openssl: for SSL support in built-in webserver
                  fcgi: for FastCGI support
                  postgresql-libs: for PostgreSQL Dbo support
                  libmariadbclient: for MySQL Dbo support
                  sqlite: for Sqlite Dbo support
                  mysql++: for the hangman example
                  qt4: for the Wt/Qt interopability example (wtwithqt)
Conflicts With  : None
Replaces        : None
Download Size   : 7,16 MiB
Installed Size  : 33,81 MiB
Packager        : Evangelos Foutras <evangelos@foutrelis.com>
Build Date      : mar 18 set 2018 05:35:48 CEST
Validated By    : MD5 Sum  SHA-256 Sum  Signature

and for g I have:

Repository      : core
Name            : gcc
Version         : 8.2.1+20180831-1
Description     : The GNU Compiler Collection - C and C++ frontends
Architecture    : x86_64
URL             : http://gcc.gnu.org
Licenses        : GPL  LGPL  FDL  custom
Groups          : base-devel
Provides        : gcc-multilib
Depends On      : gcc-libs=8.2.1+20180831-1  binutils>=2.28  libmpc
Optional Deps   : lib32-gcc-libs: for generating code for 32-bit ABI
Conflicts With  : None
Replaces        : gcc-multilib
Download Size   : 32,89 MiB
Installed Size  : 132,45 MiB
Packager        : Evangelos Foutras <evangelos@foutrelis.com>
Build Date      : ven 31 ago 2018 14:44:58 CEST
Validated By    : MD5 Sum  SHA-256 Sum  Signature

I just run command line g++, so no makefile is involved.

I have written this code:

#include <Wt/WServer.h>

WT_CXX14ONLY( wt_rocks )

and the precompiler (g++ -std=c++14 -Wall -c -E test.cpp > test.i) yields al its last two lines:

# 3 "test.cpp"
WT_CXX14ONLY( wt_rocks )

The macro isn't there, so WT_CXX14 seems to be undefined.

I'll try to recompile the whole library myself and see.

RE: Typo in a header file? - Added by lm at over 5 years ago

Oh yeah, thanks for being specific. I'm using a version of WT built and installed by me (I need a new commit that's not released yet). I have the same gcc.

RE: Typo in a header file? - Added by Vincenzo Romano over 5 years ago

I have compiled the library myself with the provided C compiler with no specific macros or flags, just "cmake .. && make".

Some of the prerequisites were already in place, like libharu (v2.3.0-2) and fcgi (v2.4.0-14).

The compilation works because the macro WT_CXX14ONLY() is being used.

My points are:

  1. if that macro is mandatory, why not generating an explicit error at compile time with #error if any feature is missing or disabled?
  2. how can I manually recompile the package and trigger thas very same issue with GCC v8.2.1?

RE: Typo in a header file? - Added by Vincenzo Romano over 5 years ago

I am asking point #2 because in order to file a bug to Archlinux I need to be able to reproduce it.

RE: Typo in a header file? - Added by Roel Standaert over 5 years ago

WT_CXX14ONLY is normally always defined when you include WDllDefs.h (which most of Wt does, and so does WServer.h). I don't know why you're getting what you're getting because I used the exact same command with the exact same compiler and the exact same version of Wt on Arch.

RE: Typo in a header file? - Added by Roel Standaert over 5 years ago

I think this means that your include path is poisoned or something. It is not pulling in the WDllDefs.h that you think it's pulling in. In your test.i file, where is it getting WDllDefs.h from?

RE: Typo in a header file? - Added by Vincenzo Romano over 5 years ago

I had to reinstall both g and Wt in order to fix the issue.

RE: Typo in a header file? - Added by Stefan Arndt over 1 year ago

Thank you :)

I Found this via google because I had the same error message on one of my systems yesterday, but reinstall did not help. The information here was still very helpful.

Here is what I did to fix my problem:

Create an even more minimal test file by pulling the mentioned header directly:

#include <Wt/WDllDefs.h>

WT_CXX14ONLY( wt_rocks )

Precompile it: g++ -std=c++14 -Wall -c -E test.cpp > test.i)

And by the method of looking very hard at test.i I spotted that I had another Wt installation in /usr/local which I must have created years ago. You can actually see the paths of the used header files in test.i. So removing /usr/local/include/Wt and the Wt-libs in /usr/local/lib fixed it for me.

Hope this is helpful to someone.

    (1-10/10)