This site has been archived and made available for preservation purposes. No edits can be made.

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Compiling c++ Scripts

  1. #1

    Compiling c++ Scripts

    All right, as a coding noob, I've been trying for hours to compile these scripts (here & here). I've been using Visual Studio 2010 and I can't for the life of me figure out how to compile these as the necessary .dll/shared object files. Trawling through google yielded no results - that I could understand at least - and as a result I'm wondering if any of you could help me?

  2. #2
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    vaultmp scripts require a C++11 compiler. I don't know how much of C++11 is already implemented in VC++. You probably need the most recent version (Visual Studio 2012).

    https://www.cpprocks.com/a-comparison...and-clang-3-1/

    I see at least three C++11 features which are lacking in VC++ but required by vaultmp. So you either have to wait for Microsoft to release an updated version of the compiler or use GCC 4.7.1 (MinGW when on Windows) or Clang.

    I'm using GCC. My recommendation is to install Code::Blocks, then overwriting MinGW with this version:

    https://sourceforge.net/projects/ming...4.7.1/release/

  3. #3
    EDIT: After messing around with it a bit I found that adding '-std=gnu++0x -U__STRICT_ANSI__' to 'other options' in the compiler settings fixes the below problem, I get a 'lib(projectname).dll' file when I compile yet I still get these two errors:

    Code :
    obj\Release\itemsave.o:itemsave.cpp:(.text+0x2d0): multiple definition of `OnPlayerDisconnect'
    obj\Release\positionsave.o:positionsave.cpp:(.text+0x1a0): first defined here

    Also the vaultserver says it can not find the script.

    Quote Originally Posted by Original Post
    I've overwritten MinGW with that version and started a .dll project in Code::Blocks which I added the two scripts two as a .cpp source along with the vaultscript.h. Now I must be doing something horribly wrong but when I go 'Build << Build' it returns with numerous errors, most notably this file appears in the window:

    Code :
    // Copyright (C) 2007, 2009 Free Software Foundation, Inc.
    //
    // This file is part of the GNU ISO C++ Library.  This library is free
    // software; you can redistribute it and/or modify it under the
    // terms of the GNU General Public License as published by the
    // Free Software Foundation; either version 3, or (at your option)
    // any later version.
     
     
    // This library is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
     
     
    // Under Section 7 of GPL version 3, you are granted additional
    // permissions described in the GCC Runtime Library Exception, version
    // 3.1, as published by the Free Software Foundation.
     
     
    // You should have received a copy of the GNU General Public License and
    // a copy of the GCC Runtime Library Exception along with this program;
    // see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
    // <https://www.gnu.org/licenses/>.
     
     
    /** @file include/c++0x_warning.h
     *  This is a Standard C++ Library header.
     */
     
     
    #ifndef VAULTCXX0X_WARNING_H
    #define VAULTCXX0X_WARNING_H 1
     
     
    #ifndef __GXX_EXPERIMENTALVAULTCXX0X__
    #error This file requires compiler and library support for the upcoming \
    ISO C++ standard, C++0x. This support is currently experimental, and must be \
    enabled with the -std=c++0x or -std=gnu++0x compiler options.
    #endif
     
     
    #endif
    Last edited by Joethlon; 09-09-2012 at 09:39 PM.

  4. #4
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    You can define a callback only once per script; either merge the contents of both scripts and their callbacks into one compilation unit by hand, or compile both scripts separately (into two object files).

  5. #5
    Thanks for the help so far Recycler, been great , I compiled the .dll's flawlessly but now it's showing a 'could not load' error in the vaultserver.


  6. #6
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    Did you compile as static library? (append -static to linker options)

    Else you need the GCC dynamic libraries installed on your Windows machine:

    libstdc++-6.dll
    libwinpthread-1.dll
    libgcc_s_sjlj-1.dll

    (those DLLs are in your MinGW files somewhere, but need to be copied into Windows/ or to vaultserver exectuable place)
    Last edited by foxtacles; 09-10-2012 at 06:03 PM.

  7. #7
    Not sure how to go about giving you those things, but here's a mediafire link for the Code::Blocks projects. https://www.mediafire.com/?6y619chk0smq84b

  8. #8
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    Compile as static library:

    https://i.imgur.com/0XU3J.png
    (then Rebuild)

    Or copy the DLLs as stated above.

  9. #9
    Still getting the same error after trying both suggestions :L

  10. #10
    Administrator
    Join Date
    Jun 2011
    Location
    Germany
    Posts
    1,057
    Blog Entries
    5
    I compiled your scripts and they work for me. They should be about ~160kb in size if you linked statically.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •