BeamMP / BeamMP-Server

Server for the multiplayer mod BeamMP for BeamNG.drive
https://beammp.com
GNU Affero General Public License v3.0
116 stars 49 forks source link

Arch compile error "copy_n is not a member of 'std';" #326

Closed redracerTURBO closed 1 month ago

redracerTURBO commented 1 month ago

Fill out general information OS: Arch Linux BeamMP-Server Version: v3.5.0

Describe the bug When compiling, this error occurs: /home/username/BeamMP-Server/include/Common.h:312:10: error: ‘copy_n’ is not a member of ‘std’; did you mean ‘copy’? Compilation does not complete.

To Reproduce Steps to reproduce the behavior: Follow the "Build from Source" instructions in README.md

Expected behavior Compile finishes

Logs output of "cmake --build bin --parallel --config Release -t BeamMP-Server -v |& tee build_error.log" build_error.log

Additional context gcc (GCC) 14.1.1 20240507 cmake version 3.29.3

I believe the solution is to add:

#include <algorithm>

to the include section of include/Common.h. I was able to successfully compile on my system with this addition. This addition is technically necessary since the algorithm header is where copy_n is defined, but on many systems it gets included from another header file.

lionkor commented 1 month ago

Wow, yeah, I had the same thing today. I mainly develop on arch as well, unsure when and where that passed review(?)

If you are interested in making a PR with your fix, I'd be happy to merge that. If not, I'll fix it.

redracerTURBO commented 1 month ago

I'd love to fix it myself, I'm very new to github haha. Glad to have the learning experience!

lionkor commented 1 month ago

Awesome! You usually

  1. make a fork
  2. make the change you want, in the fork
  3. make a pull request

Good luck and feel free to ask if anything is unclear.