c++ -o test test.cpp -lsfml-graphics -lsfml-window -lsfml-system
/tmp/ccMK05vT.o: In function `main':
test.cpp:(.text+0xf3): undefined reference to `sf::WindowBase::isOpen() const'
test.cpp:(.text+0x114): undefined reference to `sf::WindowBase::pollEvent(sf::Event&)'
As you have rightly commented, an undefined reference to error is generated by a linker during the linking phase of the build process. It occurs when a declaration for a symbol can be resolved during compilation (satisfying the compiler's requirements), but the linker can't find the definition of the symbol during the linking process.
The declarations of the sf::WindowBase::isOpen() const and sf::WindowBase::pollEvent(sf::Event&) symbols are within the SFML/Graphics.hpp header file. However, the definition or implementation of the symbol is contained within the SFML libraries.
Are you sure the build log output you have posted is accurate and full? For example, where is your include directory flag? Please post the full and accurate output of your build command or script.
Linker errors typically occur due to the configuration of the system being used to build the software article in conjunction with the linker settings used for the specific software project.
As such, could you please let me know the following:
1. What platform are you building on?
2. What compiler collection are you using (including version)?
3. What version of SFML are you trying to use?
4. Did you build the SFML libraries yourself, or did you obtain pre-built binaries?
5. Where did you install SFML?
6. What is the full path to the root of your project directory?
I accidentally had a self-compiled SFML version installed, which I accidentally had overwritten with an older version of pre-compiled packages from the Ubuntu repository. I uninstalled the repository packages, and now it compiles fine.