EOSERV Forum > EOSERV > Trunk compiling error.
Page: << 1 >>
Trunk compiling error.
Author Message
Post #201670 Trunk compiling error.

Trying to compile it all so I can start up my server, and while building I continuously get the error

c:\users\****\desktop\trunk\src\world.cpp|1222|error: 'snprintf' was not declared in this scope|||=== Build failed: 1 error(s), 6 warning(s) (1 minute(s), 37 second(s)) ===|



the lines here. 1218-1224

if (static_cast<int>(this->config["StartMap"]))

{

using namespace std;

startmapinfo = ", `map`, `x`, `y`";

snprintf(buffer, 1024, ",%i,%i,%i", static_cast<int>(this->config["StartMap"]), static_cast<int>(this->config["StartX"]), static_cast<int>(this->config["StartY"]));

startmapval = buffer;

}



How can I fix this issue?



7 years, 21 weeks ago
Post #201671 Re: Trunk compiling error.

Make sure you are using the correct version of gcc. From the wiki:

  1. Download the mingw-get Installer: http://sourceforge.net/projects/mingw/files/Installer/mingw-get-setup.exe/download.
  2. Install it to the default path: C:\MinGW. If you change the path, Code::Blocks will fail to auto-detect it later on.
  3. Run mingw-get, either through start menu or desktop shortcuts if you created them, or browsing to C:\mingw\bin and running "mingw-get.exe"
  4. Locate the following packages in the GUI, using the side-bar to navigate between sections. Ensure you check the class column is correct:
    1. Package: mingw32-gcc-g++ (Class: bin) (Basic Setup)
    2. Package: mingw32-libz (Class: dll) (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
    3. Package: mingw32-pthreads-w32 (Class: dev) (All Packages/MinGW/MinGW Libraries/MinGW Standard Libraries)
  5. Click on Installation -> Apply Changes in the menu bar
  6. The installer will automatically download and install the required components (approx. 40MB)
  7. Ensure the download and installation completed successfully. If not, the simplest option is to delete the MinGW directory and start over.
---
stay tuned.
7 years, 21 weeks ago
Post #201679 Re: Trunk compiling error.

Recent changes in the Mingw-get Installer is the problem. 

In Code Blocks, navigate to Project>Build Options>Compiler Flags
Right click the flag: Have g++ follow the C++11 ISO C++ language standard, then select Modify.
Click where it says Compiler Flags, and type -std=gnu++11 , then click OK
Rebuild the project.


---
EO Resources/Guides: â—„ eobud.boards.net â–º
7 years, 21 weeks ago
Post #202011 Re: Trunk compiling error.

http://www.cplusplus.com/reference/cstdio/snprintf/

The reference says snprintf is new and added in the 2011 update of C++

---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
7 years, 17 weeks ago
Post #202272 Re: Trunk compiling error.

Hey, Im getting this same exact error and i followed all the steps above.
Does anybody know how to fix?


nvm i fixed it, i just didnt check the box in build options after i changed it.

7 years, 13 weeks ago
Page: << 1 >>

EOSERV Forum > EOSERV > Trunk compiling error.