Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[package] SFML/2.5.1: undefined refence error #25802

Open
Smalldy opened this issue Nov 2, 2024 · 1 comment
Open

[package] SFML/2.5.1: undefined refence error #25802

Smalldy opened this issue Nov 2, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Smalldy
Copy link

Smalldy commented Nov 2, 2024

Description

undefined refence error.
view detail in steps and log

Package and Environment Details

  • Operating System+version: windows 11

Conan profile

[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja

Steps to reproduce

create a project

conan new cmake_exe -d name=sfml_test -d version=0.1

add requirements

    def requirements(self):
        self.requires("sfml/2.5.1")

add sfml window

#include "sfml_test.h"
#include <SFML/Window/Window.hpp>
#include <vector>
#include <string>
#include <SFML/Window.hpp>
int main() {
    sf::Window window(sf::VideoMode(800, 600), "SFML works!");


    sfml_test();

    std::vector<std::string> vec;
    vec.push_back("test_package");

    sfml_test_print_vector(vec);
}
conan install .    
cmake --preset conan-release   
cmake --build --preset conan-release  

Logs

Click to expand log
PS E:\code\cppcode\sfml_test> conan install .

======== Input profiles ========
Profile host:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja

Profile build:
[settings]
arch=x86_64
build_type=Release
compiler=msvc
compiler.cppstd=17
compiler.runtime=dynamic
compiler.runtime_type=Release
compiler.version=193
os=Windows
[conf]
tools.cmake.cmaketoolchain:generator=Ninja


======== Computing dependency graph ========
Graph root
    conanfile.py (sfml_test/0.1): E:\code\cppcode\sfml_test\conanfile.py
Requirements
    brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519 - Cache
    bzip2/1.0.8#d00dac990f08d991998d624be81a9526 - Cache
    flac/1.4.3#112ca54377880fa91b13268d48e17871 - Cache
    freetype/2.13.2#5d2563803c8558d4ef47271a82c73d20 - Cache
    libpng/1.6.44#9e1aa08fb46946c7c91e4ae03bd49811 - Cache
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef - Cache
    openal-soft/1.22.2#506a381e0b805519cba4a7f1ee653fed - Cache
    opengl/system#4df6fecde4084386beded3ed0e56e4ea - Cache
    sfml/2.5.1#0d529e1e47d2aeba82d66074fcc14380 - Cache
    stb/cci.20230920#ed79bd361e974a99137f214efb117eef - Cache
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6 - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache
Build requirements
    meson/1.2.2#21b73818ba96d9eea465b310b5bbc993 - Cache
    meson/1.3.2#26ce8a76a36cc275cdfee1d757bc6561 - Cache
    ninja/1.12.1#fd583651bf0c6a901943495d49878803 - Cache
    pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache
Resolved version ranges
    libpng/[>=1.6 <2]: libpng/1.6.44
    ninja/[>=1.10.2 <2]: ninja/1.12.1
    zlib/[>=1.2.11 <2]: zlib/1.3.1

======== Computing necessary packages ========
flac/1.4.3: Checking 3 compatible configurations
flac/1.4.3: Main binary package '2ae195529a63320e2d98a318b406ce6995111502' missing. Using compatible package 'f710e7f7e8379584a8fbad86de2007f08c1bf892': compiler.cppstd=14
sfml/2.5.1: Checking 3 compatible configurations
sfml/2.5.1: Main binary package 'a8294b6c0e8f6a07c4110ba0116911625286ee2d' missing. Using compatible package 'b2a861d377ed75b7575b7442d0eb5e5809192876': compiler.cppstd=14
Requirements
    brotli/1.1.0#d56d7bb9ca722942aba17369cb5c0519:75df3523cadfb3cb5a2c1cc2d61e8c640e1f9b96#249943a2756eb869cac284274651a4ab - Cache
    bzip2/1.0.8#d00dac990f08d991998d624be81a9526:67bfcb7b4b78262b9d05495e479dcd92f747316b#e4aa22ae3a31782994f99b4be58625c9 - Cache
    flac/1.4.3#112ca54377880fa91b13268d48e17871:f710e7f7e8379584a8fbad86de2007f08c1bf892#9e67149ad23e9bbd1b1b3565ca16e4fc - Cache
    freetype/2.13.2#5d2563803c8558d4ef47271a82c73d20:79f73b3fcb4ea3718b05e96b46594ae8f2ec3895#e9b07b14b986a38f75b0b42e3ea40f9e - Cache
    libpng/1.6.44#9e1aa08fb46946c7c91e4ae03bd49811:e0d2306461d10438fbd847f0556a0f0ac5653d3a#aae40fd00dee0d85633d5a33c7be64b9 - Cache
    ogg/1.3.5#062626875f5c8c59f069f76f148098ef:7bfde258ff4f62f75668d0896dbddedaa7480a0f#e927a574838328774c00363480fd0711 - Cache
    openal-soft/1.22.2#506a381e0b805519cba4a7f1ee653fed:7bfde258ff4f62f75668d0896dbddedaa7480a0f#119df173e15f3e8ac817e718fbec4185 - Cache
    opengl/system#4df6fecde4084386beded3ed0e56e4ea:da39a3ee5e6b4b0d3255bfef95601890afd80709#0ba8627bd47edc3a501e8f0eb9a79e5e - Cache
    sfml/2.5.1#0d529e1e47d2aeba82d66074fcc14380:b2a861d377ed75b7575b7442d0eb5e5809192876#630730581652fe42859edb214fe8f9ee - Cache
    vorbis/1.3.7#37e58f52e59a6232199b34ef402714a6:5716ed60be3e52a680aebcade966a2d4782db011#6bd7f8caee1c94c4eccf2f5b117619d1 - Cache
    zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:7bfde258ff4f62f75668d0896dbddedaa7480a0f#20d10b761ec15eed7a1d61c86bc7415a - Cache
Build requirements
Skipped binaries
    stb/cci.20230920, meson/1.2.2, meson/1.3.2, ninja/1.12.1, pkgconf/2.1.0

======== Installing packages ========
brotli/1.1.0: Already installed! (1 of 11)
bzip2/1.0.8: Already installed! (2 of 11)
ogg/1.3.5: Already installed! (3 of 11)
openal-soft/1.22.2: Already installed! (4 of 11)
opengl/system: Already installed! (5 of 11)
zlib/1.3.1: Already installed! (6 of 11)
flac/1.4.3: Already installed! (7 of 11)
libpng/1.6.44: Already installed! (8 of 11)
vorbis/1.3.7: Already installed! (9 of 11)
freetype/2.13.2: Already installed! (10 of 11)
sfml/2.5.1: Already installed! (11 of 11)
WARN: deprecated: Usage of deprecated Conan 1.X features that will be removed in Conan 2.X:
WARN: deprecated:     'cpp_info.names' used in: zlib/1.3.1, freetype/2.13.2, ogg/1.3.5, openal-soft/1.22.2, bzip2/1.0.8, brotli/1.1.0, sfml/2.5.1, flac/1.4.3, vorbis/1.3.7, libpng/1.6.44
WARN: deprecated:     'cpp_info.build_modules' used in: openal-soft/1.22.2, bzip2/1.0.8, freetype/2.13.2, sfml/2.5.1
WARN: deprecated:     'env_info' used in: bzip2/1.0.8, freetype/2.13.2, flac/1.4.3
WARN: deprecated:     'cpp_info.filenames' used in: opengl/system, freetype/2.13.2, flac/1.4.3
WARN: deprecated:     'user_info' used in: freetype/2.13.2

======== Finalizing install (deploy, generators) ========
conanfile.py (sfml_test/0.1): Calling generate()
conanfile.py (sfml_test/0.1): Generators folder: E:\code\cppcode\sfml_test\build\Release\generators
conanfile.py (sfml_test/0.1): CMakeDeps necessary find_package() and targets for your CMakeLists.txt
    find_package(SFML)
    target_link_libraries(... sfml::sfml)
conanfile.py (sfml_test/0.1): CMakeToolchain generated: conan_toolchain.cmake
conanfile.py (sfml_test/0.1): CMakeToolchain: Preset 'conan-release' added to CMakePresets.json.
    (cmake>=3.23) cmake --preset conan-release
    (cmake<3.23) cmake <path> -G Ninja -DCMAKE_TOOLCHAIN_FILE=generators\conan_toolchain.cmake  -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release
conanfile.py (sfml_test/0.1): CMakeToolchain generated: E:\code\cppcode\sfml_test\build\Release\generators\CMakePresets.json
conanfile.py (sfml_test/0.1): CMakeToolchain generated: E:\code\cppcode\sfml_test\CMakeUserPresets.json
conanfile.py (sfml_test/0.1): Generating aggregated env files
conanfile.py (sfml_test/0.1): Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat']
Install finished successfully
PS E:\code\cppcode\sfml_test> cmake --preset conan-release
Preset CMake variables:

  CMAKE_BUILD_TYPE="Release"
  CMAKE_POLICY_DEFAULT_CMP0091="NEW"
  CMAKE_TOOLCHAIN_FILE:FILEPATH="generators\conan_toolchain.cmake"

-- Using Conan toolchain: E:/code/cppcode/sfml_test/build/Release/generators/conan_toolchain.cmake
-- Conan toolchain: C++ Standard 17 with extensions OFF
-- Conan: Component target declared 'sfml-system'
-- Conan: Component target declared 'sfml-main'
-- Conan: Component target declared 'sfml-window'
-- Conan: Component target declared 'sfml-graphics'
-- Conan: Component target declared 'sfml-network'
-- Conan: Component target declared 'sfml-audio'
-- Conan: Target declared 'sfml::sfml'
-- Conan: Target declared 'opengl::opengl'
-- Conan: Target declared 'Freetype::Freetype'
-- Conan: Target declared 'PNG::PNG'
-- Conan: Target declared 'ZLIB::ZLIB'
-- Conan: Target declared 'BZip2::BZip2'
-- Conan: Including build module from 'C:/Users/74368/.conan2/p/bzip25d2dbaf142a52/p/lib/cmake/conan-official-bzip2-variables.cmake'
-- Conan: Component target declared 'brotli::brotlicommon'
-- Conan: Component target declared 'brotli::brotlidec'
-- Conan: Component target declared 'brotli::brotlienc'
-- Conan: Target declared 'brotli::brotli'
-- Conan: Including build module from 'C:/Users/74368/.conan2/p/freetf35e04f91db9d/p/lib/cmake/conan-official-freetype-variables.cmake'
-- Conan: Component target declared 'FLAC::FLAC'
-- Conan: Component target declared 'FLAC::FLAC++'
-- Conan: Target declared 'flac::flac'
-- Conan: Component target declared 'Ogg::ogg'
-- Conan: Target declared 'OpenAL::OpenAL'
-- Conan: Including build module from 'C:/Users/74368/.conan2/p/opena005d0fd6b1bf8/p/lib/cmake/conan-official-openal-soft-variables.cmake'
-- Conan: Component target declared 'Vorbis::vorbis'
-- Conan: Component target declared 'Vorbis::vorbisenc'
-- Conan: Component target declared 'Vorbis::vorbisfile'
-- Conan: Component target declared 'vorbis::vorbisenc-alias'
-- Conan: Component target declared 'vorbis::vorbisfile-alias'
-- Conan: Target declared 'vorbis::vorbis'
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: E:/code/cppcode/sfml_test/build/Release

PS E:\code\cppcode\sfml_test> cmake --build --preset conan-release
[1/1] Linking CXX executable sfml_test.exe
FAILED: sfml_test.exe
C:\WINDOWS\system32\cmd.exe /C "cd . && C:\Users\74368\mingw64\bin\c++.exe -O3 -DNDEBUG  CMakeFiles/sfml_test.dir/src/sfml_test.cpp.obj CMakeFiles/sfml_test.dir/src/main.cpp.obj -o sfml_test.exe -Wl,--out-implib,libsfml_test.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -LC:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib   -LC:/Users/74368/.conan2/p/flac4e4c01cac6483/p/lib   -LC:/Users/74368/.conan2/p/ogg0603e0d7ed2e4/p/lib   -LC:/Users/74368/.conan2/p/opena005d0fd6b1bf8/p/lib   -LC:/Users/74368/.conan2/p/vorbib3b87ba3196b8/p/lib   -LC:/Users/74368/.conan2/p/freetf35e04f91db9d/p/lib   -LC:/Users/74368/.conan2/p/libpn9bfcc2eca1f06/p/lib   -LC:/Users/74368/.conan2/p/zlib6f797a4dd16fb/p/lib   -LC:/Users/74368/.conan2/p/bzip25d2dbaf142a52/p/lib   -LC:/Users/74368/.conan2/p/brotl79757a5cae055/p/lib C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-audio-s.lib  C:/Users/74368/.conan2/p/flac4e4c01cac6483/p/lib/FLAC++.lib  C:/Users/74368/.conan2/p/flac4e4c01cac6483/p/lib/FLAC.lib  C:/Users/74368/.conan2/p/opena005d0fd6b1bf8/p/lib/OpenAL32.lib  -lole32  -lshell32  -luser32  C:/Users/74368/.conan2/p/vorbib3b87ba3196b8/p/lib/vorbisfile.lib  C:/Users/74368/.conan2/p/vorbib3b87ba3196b8/p/lib/vorbisenc.lib  C:/Users/74368/.conan2/p/vorbib3b87ba3196b8/p/lib/vorbis.lib  C:/Users/74368/.conan2/p/ogg0603e0d7ed2e4/p/lib/ogg.lib  C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-network-s.lib  -lws2_32  C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-graphics-s.lib  C:/Users/74368/.conan2/p/freetf35e04f91db9d/p/lib/freetype.lib  C:/Users/74368/.conan2/p/libpn9bfcc2eca1f06/p/lib/libpng16_static.lib  C:/Users/74368/.conan2/p/zlib6f797a4dd16fb/p/lib/zlib.lib  C:/Users/74368/.conan2/p/bzip25d2dbaf142a52/p/lib/bz2.lib  C:/Users/74368/.conan2/p/brotl79757a5cae055/p/lib/brotlienc.lib  C:/Users/74368/.conan2/p/brotl79757a5cae055/p/lib/brotlidec.lib  C:/Users/74368/.conan2/p/brotl79757a5cae055/p/lib/brotlicommon.lib  C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-window-s.lib  -lgdi32  -lopengl32  C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-main.lib  C:/Users/74368/.conan2/p/sfml1bca5639e7c93/p/lib/sfml-system-s.lib  -lwinmm  -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
C:/Users/74368/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/sfml_test.dir/src/main.cpp.obj:main.cpp:(.text.startup+0x52): undefined reference to `sf::String::String(char const*, std::locale const&)'
C:/Users/74368/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/sfml_test.dir/src/main.cpp.obj:main.cpp:(.text.startup+0x6d): undefined reference to `sf::VideoMode::VideoMode(unsigned int, unsigned int, unsigned int)'
C:/Users/74368/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/sfml_test.dir/src/main.cpp.obj:main.cpp:(.text.startup+0xa7): undefined reference to `sf::Window::Window(sf::VideoMode, sf::String const&, unsigned int, sf::ContextSettings const&)'
C:/Users/74368/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/sfml_test.dir/src/main.cpp.obj:main.cpp:(.text.startup+0x1a0): undefined reference to `sf::Window::~Window()'
C:/Users/74368/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: CMakeFiles/sfml_test.dir/src/main.cpp.obj:main.cpp:(.text.startup+0x1d3): undefined reference to `sf::Window::~Window()'
collect2.exe: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
@Smalldy Smalldy added the bug Something isn't working label Nov 2, 2024
@Smalldy
Copy link
Author

Smalldy commented Nov 2, 2024

project file:
sfml_test.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant