Filament: enum Result colliding with X11 #define during compile

Created on 2 Sep 2019  路  3Comments  路  Source: google/filament

I downloaded the latest release 1.3.2 and was attempting to compile a Filament app I made before that worked for a previous release of Filament.

When I compile using the makefile:

FILAMENT_LIBS=-lfilament -lbackend -lbluegl -lbluevk -lfilabridge -lfilaflat -lutils -lgeometry -lsmol-v -libl
CC=clang++

main: main.o
    $(CC) -Llib/x86_64/ main.o $(FILAMENT_LIBS) -lpthread -lc++ -ldl -lSDL2 -o main

main.o: main.cpp
    $(CC) -Iinclude/ -std=c++14 -pthread -c main.cpp

clean:
    rm -f main main.o

.PHONY: clean

I get the error:

include/filament/LightManager.h:434:31: error: expected identifier
    enum Result { Error = -1, Success = 0 };
                              ^
/usr/include/X11/X.h:350:21: note: expanded from macro 'Success'
#define Success            0    /* everything's okay */

OS: Arch Linux x86_64
Host: XPS 15 9560
Kernel: 5.2.11-arch1-1-ARCH
DE: GNOME 3.32.2
CPU: Intel i7-7700HQ (8) @ 3.800GHz
GPU: NVIDIA GeForce GTX 1050 Mobile
GPU: Intel HD Graphics 630

Xorg info:
version number: 11.0
X.Org version: 1.20.5

clang info:
clang version 8.0.1 (tags/RELEASE_801/final)
Target: x86_64-pc-linux-gnu
Thread model: posix

bug linux

All 3 comments

Do you have a more detailed error? What do you include in your main.cpp file (none of our sample trigger this compilation error on Linux)? LightManager.h itself doesn't include any X11 related header.

I will close this bug because I don't think we should fix it on our end. You should either #undef Success before including LightManager or change the order of your includes.

Thank you that helped me

Was this page helpful?
0 / 5 - 0 ratings

Related issues

molysgaard picture molysgaard  路  6Comments

luca-90 picture luca-90  路  9Comments

jiqimaogou picture jiqimaogou  路  6Comments

yongtang picture yongtang  路  5Comments

dakom picture dakom  路  5Comments