How do you make a element?

  • antoine
    3rd Jan 2014 Banned 1 Permalink
    This post is hidden because the user is banned
  • CookiesGaming
    5th Jan 2014 Member 2 Permalink

     

     

    Edited once by CookiesGaming. Last: 7th Jan 2015
  • Argentum
    25th Jan 2014 Member 0 Permalink

    Would you mind elaborating a bit on that, CookiesGaming?  I am a complete noob to powder toy development and to the C++ language, just downloaded and installed VB C++ 2010 yesterday.  I do have some experience with other programming languages, mainly the Arduino language. 

     

    I was trying to create a new element with the coding tutorial on the powder toy wiki.  Before I tried to make my own element, I compiled the unmodified source code and it sucessfully compiled.  I ran the newly compiled .exe file and it ran like a charm. 

     

    After doing this, I followed all of the instructions in the coding tutorial to the letter, but I am getting the following error when I try to compile the solution:

     

    LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
    ElementClasses.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Element_HETR::~Element_HETR(void)" (??1Element_HETR@@UAE@XZ) referenced in function "class std::vector<class Element,class std::allocator<class Element> > __cdecl GetElements(void)" (?GetElements@@YA?AV?$vector@VElement@@V?$allocator@VElement@@@std@@@std@@XZ)
    ElementClasses.obj : error LNK2019: unresolved external symbol "public: __thiscall Element_HETR::Element_HETR(void)" (??0Element_HETR@@QAE@XZ) referenced in function "class std::vector<class Element,class std::allocator<class Element> > __cdecl GetElements(void)" (?GetElements@@YA?AV?$vector@VElement@@V?$allocator@VElement@@@std@@@std@@XZ)
    C:\Documents and Settings\Eddie\Desktop\TPT Modding stuff\The-Powder-Toy-master\Build\Argentum's Mod.exe : fatal error LNK1120: 2 unresolved externals
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

     

    I have no idea what this means or what is going wrong.  The new element file I used was the one that was linked to in the tutorial (the HETR one).  I did not modify the file: I just dragged and dropped it into the src\simulation\elements folder. 

     

    Is there a step I missed or did wrong?  Again I am a complete n00b and if someone could provide some idiot-proof help, it would really be appreciated!

    Edited 2 times by Argentum. Last: 25th Jan 2014
  • FeynmanLogomaker
    25th Jan 2014 Member 0 Permalink

    Hmm, maybe there's an error in the code you wrote?

  • Argentum
    25th Jan 2014 Member 0 Permalink

    @FeynmanLogomaker (View Post)

    I dont think so.  I didnt change anything about the HETR file.

  • nucular
    26th Jan 2014 Member 0 Permalink
    @Argentum
    That sounds like a typo to me... Are you sure that the functions are named like they are supposed to be? Compare your file with the provided example code (for the lazy: here).
  • Argentum
    26th Jan 2014 Member 0 Permalink

    @nucular (View Post)

     Okay Im trying it and will report back


    They are exactly the same file.

    thanks for the link nucular

    There was something I noticed but forgot to post here.  Even after I removed the HETR file from the elements folder, I still got the same error, even after I closed the solution and opened it again.

     

    I deleted my solution and started over with the unmodified source code from github.  I followed the visual studio compiling instructions and I sucessfully got a fully functional copy of the powder toy.

     

    Im hoping that adding the HETR element wont do anything wierd to it.

     

    Update:  Here is the exact procedure in which I did things.

     

    1. I downloaded all of the source code and required libraries.  I then followed all of the instructions for compiling the powder toy with visual studio.  After following these instructions, I compiled the unmodified source code.  This left me with a working copy of the powder toy in my /build folder.
    2. I then downloaded the HETR element C++ file.  I cut-and-pasted it into the src/simulation/elements folder.
    3. I executed the "generator.py" file that was included with the source code.  A console window popped up for a second and closed again.  From what I read, this means that the file worked.
    4. I then attempted to compile the modified solution with the HETR file included with the elements.  All was going great until I got the following error:

    LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/OPT:ICF' specification
    ElementClasses.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall Element_HETR::~Element_HETR(void)" (??1Element_HETR@@UAE@XZ) referenced in function "class std::vector<class Element,class std::allocator<class Element> > __cdecl GetElements(void)" (?GetElements@@YA?AV?$vector@VElement@@V?$allocator@VElement@@@std@@@std@@XZ)
    ElementClasses.obj : error LNK2019: unresolved external symbol "public: __thiscall Element_HETR::Element_HETR(void)" (??0Element_HETR@@QAE@XZ) referenced in function "class std::vector<class Element,class std::allocator<class Element> > __cdecl GetElements(void)" (?GetElements@@YA?AV?$vector@VElement@@V?$allocator@VElement@@@std@@@std@@XZ)
    C:\Documents and Settings\Eddie\My Documents\Visual Studio 2010\Projects\The Powder Toy\Copy of The-Powder-Toy-master\Build\the powder toy master.exe : fatal error LNK1120: 2 unresolved externals

     

    I just don't get what is going on!

    Edited 5 times by Argentum. Last: 26th Jan 2014
  • nucular
    26th Jan 2014 Member 1 Permalink
    @Argentum
    Try removing the HETR.cpp and then running the generator.py by hand.
  • Argentum
    26th Jan 2014 Member 0 Permalink

    @nucular (View Post)

    when you say running it by hand, do you mean double clicking it?

    Thats what I did when I added the HETR c++ file to the solution files.

     

    Anyway I followed your instructions and the build worked again!  I think it must be the HETR file.  I will check it for typos and report it

     

    Here is a pastebin for the code of the HETR element file.  In the meantime, I am going to try to create a new element from scratch and see if I get the same error.

    Edited 5 times by Argentum. Last: 26th Jan 2014
  • nucular
    26th Jan 2014 Member 0 Permalink
    @Argentum
    Did you follow the instruction at the first code line?