8wDlpd.png
8wDFp9.png
8wDEOx.png
8wDMfH.png
8wDKte.png

将 skompile 模型复制到剪贴板

user915 2月前

64 0

我使用线渲染器创建了两条线。除了 Y 值外,它们的长度和位置相同。第 1 行位置:起始:(constStartX,0.005f,constStartZ)结束:(constEndX,0.001f,

我使用线条渲染器创建了两条线条。除 Y 值外,它们的长度和位置相同。

第 1 行位置:开始:(constStartX,0.005f,constStartZ)结束:(constEndX,0.001f,constEndZ)

第 2 行位置:开始:(constStartX,0.001f,constStartZ)结束:(constEndX,0.005f,constEndZ)

我希望的结果是,当从顶部的相机观察线条时,我们只能看到每条线的一半(高于另一条线的那一半)。

这对于透视相机很有效,但对于正交相机则不行。它会将一条线完全渲染到另一条线上,即使在 3D 空间中该线较低的一半。

有没有办法用正交相机获得所需的行为(在每个点渲染具有最大 y 值的线)?谢谢!

帖子版权声明 1、本帖标题:将 skompile 模型复制到剪贴板
    本站网址:http://xjnalaquan.com/
2、本网站的资源部分来源于网络,如有侵权,请联系站长进行删除处理。
3、会员发帖仅代表会员个人观点,并不代表本站赞同其观点和对其真实性负责。
4、本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
5、站长邮箱:yeweds@126.com 除非注明,本帖由user915在本站《ubuntu》版块原创发布, 转载请注明出处!
最新回复 (0)
  • 我需要添加带有自定义着色器的自定义材质。着色器如下:

    Shader "Custom/LineDepth"
    {
        Properties
        {
            _Color ("Color", Color) = (1,1,1,1)
        }
        SubShader
        {
            Tags { "Queue"="Geometry" "RenderType"="Opaque" }
            LOD 200
    
            ZWrite On
            ZTest LEqual
    
            Pass
            {
                CGPROGRAM
                #pragma vertex vert
                #pragma fragment frag
                #include "UnityCG.cginc"
    
                struct appdata_t
                {
                    float4 vertex : POSITION;
                    float4 color : COLOR;
                };
    
                struct v2f
                {
                    float4 pos : SV_POSITION;
                    float4 color : COLOR;
                };
    
                fixed4 _Color;
    
                v2f vert (appdata_t v)
                {
                    v2f o;
                    o.pos = UnityObjectToClipPos(v.vertex);
                    o.color = v.color * _Color;
                    return o;
                }
    
                fixed4 frag (v2f i) : SV_Target
                {
                    return i.color;
                }
                ENDCG
            }
        }
        FallBack "Diffuse"
    }
    
  • 我有一个随机森林模型,使用 scikit-learn 在 Python 3.11.0 中对其进行了训练。然后,我使用 skompiler 0.7 导出模型权重。然后,我将模型权重导出到数据框,然后合并...

    我有一个随机森林模型,我在 Python 3.11.0 中使用 scikit-learn 对其进行了训练。然后,我使用 skompiler 0.7 导出模型权重。然后,我将模型权重导出到数据框,然后复制到剪贴板。我安装了 pyperclip 1.8.2。我在运行代码的 ubuntu 20.04.6 LTS 服务器上安装了 xclip 和 xsel。当我在 ubuntu 服务器托管的 jupyter 笔记本中的一个单元格中运行代码时,出现以下错误。您知道问题可能是什么吗?您能建议如何解决它吗?

    代码:

    from skompiler import skompile
    from skompiler.fromskast.excel import excel_range
    
    expr = skompile(rf.predict,excel_range(f"B3:BQ3")
    
    code = expr.to('excel', multistage=True, assign_to=exccel_range('BT3:*3'))
    
    code.to_dataframe().to_clipboard()
    

    错误:

    PyperclipException                        Traceback (most recent call last)
    Cell In[48], line 1
    ----> 1 code.to_dataframe().to_clipboard()
    
    File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/util/_decorators.py:333, in deprecate_nonkeyword_arguments.<locals>.decorate.<locals>.wrapper(*args, **kwargs)
        327 if len(args) > num_allow_args:
        328     warnings.warn(
        329         msg.format(arguments=_format_argument_list(allow_args)),
        330         FutureWarning,
        331         stacklevel=find_stack_level(),
        332     )
    --> 333 return func(*args, **kwargs)
    
    File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/core/generic.py:3244, in NDFrame.to_clipboard(self, excel, sep, **kwargs)
        3177 r"""
        3178 Copy object to the system clipboard.
        3179 
        (...)
        3240    pyperclip.copy(html)
        3241 """
        3242 from pandas.io import clipboards
    -> 3244 clipboards.to_clipboard(self, excel=excel, sep=sep, **kwargs)
    
    File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboards.py:178, in to_clipboard(obj, excel, sep, **kwargs)
        175     obj.to_csv(buf, sep=sep, encoding="utf-8", **kwargs)
        176     text = buf.getvalue()
    --> 178     clipboard_set(text)
        179     return
        180 except TypeError:
    
    File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboard/__init__.py:659, in lazy_load_stub_copy(text)
        657 global copy, paste
        658 copy, paste = determine_clipboard()
    --> 659 return copy(text)
    
    File /anaconda/envs/channels/lib/python3.11/site-packages/pandas/io/clipboard/__init__.py:316, in init_no_clipboard.<locals>.ClipboardUnavailable.__call__(self, *args, **kwargs)
        315 def __call__(self, *args, **kwargs):
    --> 316     raise PyperclipException(EXCEPT_MSG)
    
    PyperclipException: 
        Pyperclip could not find a copy/paste mechanism for your system.
        For more information, please visit
        https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error
    
  • 当我从 yaml 文件构建 snapcraft 时,软件包从 http://security.ubuntu.com 和 http://archive.ubuntu.com 中提取。这是有道理的,因为我正在使用 core24 基本 snap,这是 com...

    当我从 yaml 文件构建 snapcraft 时,软件包被从中提取 http://security.ubuntu.com 出来 http://archive.ubuntu.com .

    这是有道理的,因为我正在使用 core24 基本快照,并且它来自其配置 /etc/apt/sources.list.d/ubuntu.sources .

    现在我该如何改变这一点以便在该阶段 Fetching stage-packages 使用另一台服务器?

    以下是一个示例配置:

    name: app-simple
    
    base: core24
    grade: devel
    confinement: strict
    
    apps:
      test:
        command: usr/bin/test
    
    parts:
      test:
        plugin: nil
        source: test
        source-type: local
        build-packages:
          - clang
          - cmake
          - ninja-build
          - libfmt-dev
        stage-packages:
          - libfmt9
        override-build:
          cmake ${CRAFT_PROJECT_DIR} -G Ninja
          ninja test
          mkdir -p "${CRAFT_PART_INSTALL}/usr/bin/"
          cp test "${CRAFT_PART_INSTALL}/usr/bin/test"
    

    然后我使用 lxd 以下命令运行它:

    snapcraft --verbosity debug --debug
    

    最终运行:

    2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.023 Fetching stage-packages                                    
    2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.023 Requested stage-packages: ['clang', 'cmake', 'ninja-build', 'libfmt-dev']                                                  
    2024-06-12 22:53:38.005 :: 2024-06-12 22:48:35.025 Executing: ['apt-get', 'update']                           
    2024-06-12 22:53:38.005 :: 2024-06-12 22:48:39.356 :: Hit:1 http://security.ubuntu.com/ubuntu noble-security InRelease                                                                                                       
    2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.433 :: Ign:2 http://archive.ubuntu.com/ubuntu noble InRelease  
    2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.434 :: Ign:3 http://archive.ubuntu.com/ubuntu noble-updates InRelease                                                                                                         
    2024-06-12 22:53:38.005 :: 2024-06-12 22:49:28.434 :: Ign:4 http://archive.ubuntu.com/ubuntu noble-backports InRelease                                            
    

    我知道我可以覆盖不同的阶段,但所有阶段似乎都发生在获取阶段之后。

  • 我的导航系统是围绕 Aron Granberg 的 A* Pathfinder 项目构建的(Unity 资产商店中的资产,或简称为“webbing”)。它的语法与 Unity 的 Navmesh 非常相似

    我的导航系统是围绕 Aron Granberg 的 A* Pathfinder 项目(在 Unity 资产商店中找到的资产或简称为“webbing”)。其语法与 Unity 的 Navmesh 导航的读写方式非常相似。

    下面的代码示例正确地将代理导航到 内的预定位置 List<T> 根据其 Vector3 排名 获得目标 。我的逻辑失败之处在于整个阵型不会像我目前所做的那样旋转。所有个体都会独立旋转和移动,但每次调用这些函数时,位置对齐都会保持在同一方向上。

    TL;DR :这会将单位移动到战术排列中,但不会旋转整个阵型。我想旋转整个阵型。

    public class ReadyUnit
        {
            public PlayerControl player { get; set; }
            public int rank { get; set; }
        }
    
        public class Formation : MonoBehaviour
        {
            public Formation Instance { get; private set; }
    
            enum order
            {
                loose,
                column,
                circle,
                vanguard,
                firingLine
            }
    
            [Header("All player characters share the same SINGLE PathOrganizer in the scene.")]
            [SerializeField] order arrangement = order.loose;
            [Range(1, 15)][SerializeField] int rank;
            PathOrganizer organizer;
            ReadyUnit unit;
            public static List<ReadyUnit> readyUnitList = new List<ReadyUnit>();
            int currentRank;
            
    
            private void Awake()
            {
                unit = new ReadyUnit { player = gameObject.GetComponent<PlayerControl>(), rank = currentRank };
            }
    
            private void Start()
            {
                if (IsLeader())
                {
                    unit.rank = 0;
                }
                else
                {
                    unit.rank = rank;
                }
    
                /* There should only be ONE instance of PathOrganizer in the scene */
                organizer = FindFirstObjectByType<PathOrganizer>();
                Selector.Instance.UnitSelectedEvent += OnUnitSelected;
            }
    
            void OnUnitSelected(object sender, EventArgs e)
            {
                if (Selector.Instance.GetSelectedPlayersList().Contains(gameObject.GetComponent<PlayerControl>()) && 
                    readyUnitList.Contains(unit) == false)
                {
                    readyUnitList.Add(unit);
                }
    
                if (Selector.Instance.GetSelectedPlayersList().Contains(gameObject.GetComponent<PlayerControl>()) == false &&
                    readyUnitList.Contains(unit))
                {
                    readyUnitList.Remove(unit);
                }
    
                if (Selector.Instance.GetSelectedUnit() == gameObject.GetComponent<PlayerControl>())
                {
                    unit.rank = 0;
                }
                else
                {
                    unit.rank = rank;
                }
    
                SortUnitsByRank();
            }
    
            void SortUnitsByRank()
            {
                readyUnitList.Sort((leftHand, rightHand) => leftHand.rank.CompareTo(rightHand.rank));
            }
    
            public void FallInStep(Vector3 point)
            {
                if (point == null)
                {
                    return;
                }
    
                if (readyUnitList == null)
                {
                    return;
                }
    
                SortUnitsByRank();
                MoveToPosition(point);
            }
    
            void MoveToPosition(Vector3 point)
            {
                switch (arrangement)
                {
                    case order.loose:
                        LooseArrangement(point);
                        break;
                    case order.column:
                        ColumnArrangement(point);
                        break;
                    case order.circle:
                        CircleArrangement(point);
                        break;
                    case order.vanguard:
                        VanguardArrangement(point);
                        break;
                    case order.firingLine:
                        FiringLine(point); 
                        break;
                }
            }
    
            bool IsLeader()
            {
                return Selector.Instance.GetSelectedUnit() == gameObject.GetComponent<PlayerControl>();
            }
    
            void LooseArrangement(Vector3 point)
            { 
                float offset = Random.Range(-2f, 2f);
    
                List<Vector3> values = new List<Vector3>
                {
                    point,
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset),
                    point + new Vector3(offset, 0, offset)
                };
    
                for (int i = 0; i < values.Count; i++) 
                {
                    PlayerControl player = readyUnitList[i].player;
                    player.GetComponent<MovementManager>().MoveToDestination(values[i]);
                }
            }
    
            void ColumnArrangement(Vector3 point)
            {
                List<Vector3> values = new List<Vector3>()
                {
                    point,
                    point + new Vector3(2f, 0, 0),
                    point + new Vector3(0, 0, -2f),
                    point + new Vector3(2f, 0, -2f),
                    point + new Vector3(0, 0, -4f),
                    point + new Vector3(2f, 0, -4f),
                    point + new Vector3(0, 0, -6f),
                    point + new Vector3(2f, 0, -6f),
                    point + new Vector3(0, 0, -8f),
                    point + new Vector3(2f, 0, -8f),
                    point + new Vector3(0, 0, -10f),
                    point + new Vector3(2f, 0, -10f),
                };
    
                for (int i = 0; i < readyUnitList.Count; i++)
                {
                    PlayerControl player = readyUnitList[i].player;
                    organizer.transform.position = point;
                    organizer.AssignPosition(values[i]);
                    
                    player.GetComponent<MovementManager>().MoveToDestination(organizer.ConfirmedPosition());
                }
            }
    
            void CircleArrangement(Vector3 point) 
            {
                float diameter = 2.5f;
    
                for (int i = 0; i < readyUnitList.Count; i++)
                {
                    float angle = (float)(i * (2f * Math.PI / readyUnitList.Count));
                    float cos = (float)Math.Cos(angle) * diameter;
                    float sin = (float)Math.Sin(angle) * diameter;
    
                    point = new Vector3(point.x + cos, point.y, point.z + sin);
                    PlayerControl player = readyUnitList[i].player;
                    player.GetComponent<MovementManager>().MoveToDestination(point);
                }
            }
    
            void VanguardArrangement(Vector3 point)
            {
                List<Vector3> values = new List<Vector3>()
                {
                    point,
                    point + new Vector3(1f, 0, -1f),
                    point + new Vector3(-1f, 0, -1f),
                    point + new Vector3(2f, 0, -2f),
                    point + new Vector3(-2f, 0, -2f),
                    point + new Vector3(3f, 0, -3f),
                    point + new Vector3(-3f, 0, -3f),
                    point + new Vector3(4f, 0, -4f),
                    point + new Vector3(-4f, 0, -4f),
                    point + new Vector3(5f, 0, -5f),
                    point + new Vector3(-5f, 0, -5f),
                    point + new Vector3(0, 0, -1f),
                };
    
                for (int i = 0; i < readyUnitList.Count; i++)
                {
                    PlayerControl player = readyUnitList[i].player;
                    organizer.transform.position = point;
                    organizer.AssignPosition(values[i]);
    
                    player.GetComponent<MovementManager>().MoveToDestination(organizer.ConfirmedPosition());
                }
            }
    
            void FiringLine(Vector3 point)
            {
                List<Vector3> values = new List<Vector3>()
                {
                    point,
                    point + new Vector3(1f, 0, 0),
                    point + new Vector3(-1f, 0, 0),
                    point + new Vector3(2f, 0, 0),
                    point + new Vector3(-2f, 0, 0),
                    point + new Vector3(3f, 0, 0),
                    point + new Vector3(-3f, 0, 0),
                    point + new Vector3(4f, 0, 0),
                    point + new Vector3(-4f, 0, 0),
                    point + new Vector3(5f, 0, 0),
                    point + new Vector3(-5f, 0, 0),
                    point + new Vector3(6f, 0, 0),
                };
    
                for (int i = 0; i < values.Count; i++)
                {
                    PlayerControl player = readyUnitList[i].player;
                    player.GetComponent<MovementManager>().MoveToDestination(values[i]);
                }
            }
        }
    
    

    其意义跨越了党派界限:

    public class PathOrganizer : MonoBehaviour
    {
        [SerializeField] GameObject destinationMarker = null;
        IAstarAI agent;
        MovementManager movement;
        Vector3 callback = Vector3.zero;
    
        private void Awake()
        {
            agent = GetComponent<IAstarAI>();
            GetComponent<MovementManager>();
        }
    
        void Start()
        {
            transform.position = Selector.Instance.GetSelectedUnit().transform.position;
            movement.ReachDestinationEvent += OnDestinationReached;
        }
    
        void OnDestinationReached(object sender, EventArgs e)
        {
            foreach (Transform child in gameObject.transform)
            {
                Destroy(child.gameObject);
            }
        }
    
        public void ClearDestinationMarkers()
        {
            foreach(Transform child in gameObject.transform)
            {
                Destroy(child.gameObject);
            }
        }
    
        public void AssignPosition(Vector3 point)
        {
            agent.destination = point;
            GameObject waypoint = Instantiate(destinationMarker, point, Quaternion.identity);
            waypoint.transform.SetParent(gameObject.transform, true);    
            waypoint.transform.eulerAngles = new Vector3(90, 0, 0);
            callback = point;
        }
    
        public Vector3 ConfirmedPosition()
        {
            return callback;
        }
    
        public void SteerFormation()
        {
            agent.destination = Input.mousePosition;
        }
    }
    

    变量 Vector3 回调 将向量返回到 MovementManager.cs ,从而完成移动。这部分也运行得很好。最后一种方法 ( SteerFormation ) 是我遇到的问题。您在那里看到的只是一个占位符命令,直到我最终能够在这个挑战中获得 \'W\'。我尝试了更复杂的旋转逻辑,包括查找方向和幅度或将其与相机的视野对齐。之前的失败和上面的失败确实会转动容器 GameObject ( PathOrganizer ),但其中的位置从未改变。

    我认为问题在于,这些实例化的位置(通过 destinationMarker)反映了全球定位,实际上只不过是它们所在地面上的标记。我希望这些标记能够像公交车一样放在 PathOrganizer 内,而代理则是追赶公交车的狗。理论上,如果我驾驶公交车,整个羊群都会跟着我。我调查过类似的查询,但没有找到(或者可能没有理解)令人满意的解决方案。

  • 从“逻辑”的角度来看,我的所有“进化”都从已知的阵型开始;例如“线”。如果阵型不确定,则必须先“组装”。对于每个阵型,我已经(预先)确定了每个单位的“终点”和朝向角度。然后我单独编写每个脚本。如果是“最短路线”,它们会按照自己的持续时间运行。如果它们需要同时“到达”,则它们都设置为相同的持续时间。对于更“精细”的进化,我添加了中间点;例如,在前进 Y 之前向左走 x;以避免障碍物或“碰撞”。(这都是“生成的”)

  • 嗯,我喜欢。按部就班,让每个人都在船上找到自己的位置(可以这么说),然后按船的命令出发。由于我刚刚读到这篇文章,我还没有为此付出任何努力。这确实提供了一个敏锐的假设。

  • 单位在队列中有一个“固定”位置,即“发布顺序”(我的术语)。有左翼和右翼。有一个“中心”(颜色)。在列中,它是“左在前”,或者,右在前。(我添加了图标来显示翅膀和颜色)。“杀死”一个翼或颜色小队,阵型(组)就会“粉碎”。不再担心进化。:0)

  • Shud 2月前 0 只看Ta
    引用 9

    我是 cmake 和 sfml 的新手,我想学习 cpp 游戏开发。在我的 Linux 机器上,我收到此错误:[1/1] 链接 CXX 可执行文件 SFMLAppFAILED:SFMLApp:&& /usr/bin/c++ -g CMake...

    我是 cmake 和 sfml 的新手,我想学习 cpp 游戏开发。在我的 Linux 机器上我收到此错误:

    [1/1] Linking CXX executable SFMLApp
    FAILED: SFMLApp 
    : && /usr/bin/c++ -g  CMakeFiles/SFMLApp.dir/main.cpp.o -o SFMLApp -L/home/issa/CLionProjects/Graphics_demo/SFML_LIBRARY_DIR -Wl,-rpath,/home/issa/CLionProjects/Graphics_demo/SFML_LIBRARY_DIR:/home/issa/Cpp-libs/SFML-2.6.1/lib  /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-graphics-d.so.2.6.1  /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-window-d.so.2.6.1  /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1  /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-system-d.so.2.6.1 && :
    /usr/bin/ld: warning: libFLAC.so.12, needed by /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1, not found (try using -rpath or -rpath-link)
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_skip_single_frame'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_process_until_end_of_metadata'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_seek_absolute'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_init_file'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_finish'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_finish'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_process_interleaved'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_channels'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_new'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_new'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_delete'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_sample_rate'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_process_single'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_get_state'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_decoder_init_stream'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_delete'
    /usr/bin/ld: /home/issa/Cpp-libs/SFML-2.6.1/lib/libsfml-audio-d.so.2.6.1: undefined reference to `FLAC__stream_encoder_set_bits_per_sample'
    collect2: error: ld returned 1 exit status
    ninja: build stopped: subcommand failed.
    

    我已经安装了 libflac-dev:

     $ sudo find /* -name libFLAC.so.*
    ...
    /usr/lib/x86_64-linux-gnu/libFLAC.so.8
    /usr/lib/x86_64-linux-gnu/libFLAC.so.8.3.0
    ...
    

    我应该做什么更改才能在 CMakeLists.txt 中链接 libflac-dev:

    cmake_minimum_required(VERSION 3.25)
    project(Graphics_demo)
    
    set(CMAKE_CXX_STANDARD 17)
    
    add_executable(Graphics_demo main.cpp)
    
    set(EXECUTABLE_NAME "SFMLApp")
    set(SFML_INCLUDE_DIR "/home/issa/Cpp-libs/SFML-2.6.1/include")
    set(SFML_LIBRARY_DIR "/home/issa/Cpp-libs/SFML-2.6.1/lib")
    set(SFML_DIR "/home/issa/Cpp-libs/SFML-2.6.1/lib/cmake/SFML")
    
    link_directories(SFML_LIBRARY_DIR)
    include_directories(SFML_INCLUDE_DIR)
    
    find_package(SFML 2.6.1 COMPONENTS system window graphics audio network)
    if (SFML_FOUND)
        message(STATUS "SFML_INCLUDE_DIR: ${SFML_INCLUDE_DIR}")
        message(STATUS "SFML_LIBRARIES: ${SFML_LIBRARIES}")
        message(STATUS "SFML_VERSION: ${SFML_VERSION}")
    endif ()
    
    add_executable(SFMLApp main.cpp)
    target_link_libraries(SFMLApp sfml-graphics sfml-window sfml-system sfml-audio)
    

    为什么这个命令可以正常工作而 cmake 却不工作?

     g++ main.cpp -o main -lsfml-system -lsfml-graphics -lsfml-audio -lsfml-window
    
  • 你应该仔细阅读错误。输出的第四行解释它正在寻找 libFLAC.so.**12** 而不是 8。另一个担心是,你正在链接调试库,而你的手动

  • 解决方案:

    我终于找到了解决方案,通过 libflac12 这里 ,之后我得到了 faild to load sound error 并解决了 这里 .

    解释:

    使用时安装的 sfml 的 apt 版本 sudo apt install libsfml-dev 可以 2.5.1 很好地与 配合使用 libFLAC.so.8 由于它是从系统终端执行的,因此 g++ 此版本与命令一起使用
    我在 CMakeLists.txt 中使用的 sfml 版本 2.6.1 需要 libFLAC.so.12 .

  • 引用 12

    如果我使用; gunicorn --bind 0.0.0.0:8000 my_project.wsgi 有效那么这是我的配置: gunicorn.socket[Unit]Description=gunicorn socket[Socket]ListenStream=/run/gunicorn.sock[Install]Want...

    如果我使用; gunicorn --bind 0.0.0.0:8000 my_project.wsgi 有效

    这是我的配置:

    gunicorn.socket
    
    [Unit]
    
    Description=gunicorn socket
    
    [Socket]
    
    ListenStream=/run/gunicorn.sock
    
    [Install]
    
    WantedBy=sockets.target
    
    gunicorn service
    
    [Unit]
    
    Description=gunicorn daemon
    
    Requires=gunicorn.socket
    
    After=network.target
    
    [Service]
    
    User=my_user
    
    Group=www-data
    
    WorkingDirectory=/home/my_user/test 
    
    EnvironmentFile=/home/my_user/test/.env
    
    ExecStart=/home/my_user/test/env/bin/gunicorn \
    
    --access-logfile - \
    
    --workers 3 \
    
    --bind unix:/run/gunicorn.sock \
    
    my_project.wsgi:application
    
    [Install]
    
    WantedBy=multi-user.target
    
    /etc/nginx/sites-available/test
    
    server {
    
        listen 80;
    
        server_name IP;
    
        location = /favicon.ico { access_log off; log_not_found off; 
    }
    
    location /static/ {
    
        root /home/my_user/test;
    
    }
    
    location / {
    
        include proxy_params;
    
        proxy_pass http://unix:/run/gunicorn.sock;
    
        proxy_set_header Host $host;
    
        proxy_set_header X-Real-IP $remote_addr;
    
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    
        proxy_set_header X-Forwarded-Proto $scheme;
    
    }
    
    }
    

    每个 systemctl 状态都在运行,但我仍然显示欢迎使用 Nginx!我想显示我的 Django 应用程序。我该怎么办?

返回
作者最近主题: