i got an error

  • CaptainJL
    6th Dec 2012 Member 0 Permalink

    errors posted as when followed tutorials (after 2nd time rebuilding) (https://powdertoy.co.uk/Wiki/W/Compiling_tpt%2B%2B_with_Visual_studio.html): (Visual C++ Express)

     

     Build started: Project: tptm, Configuration: Release Win32 ------
    1>  GameModel.cpp
    1>src\game\GameModel.cpp(324): error C2668: 'sqrt' : ambiguous call to overloaded function
    1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(127): could be 'double sqrt(double)'
    1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(541): or       'float sqrt(float)'
    1>          C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\math.h(589): or       'long double sqrt(long double)'
    1>          while trying to match the argument list '(unsigned int)'
    1>  VINE.cpp
    1>src\simulation\elements\VINE.cpp(73): error C2039: 'graphics' : is not a member of 'Element_VINE'
    1>          C:\Users\Jean-Luc\Desktop\tptm\The-Powder-Toy-master\generated\ElementClasses.h(1136) : see declaration of 'Element_VINE'
    1>  Generating Code...
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

     

    I have had a bit of programming experience, but only using the basics (ie. to read values from text fies and export to text, including basic functions such as calculations, 'for', etc.)

     

    What went wrong and how can i fix it?

  • boxmein
    6th Dec 2012 Former Staff 0 Permalink
    @CaptainJL (View Post)
    You called a function which had many different forms but didn't know how to handle your input which wasn't any of them.
    sqrt() needs a long double, a float or a double. Those are number types and they all have a decimal point.
    easy fix:
    float root = sqrt((float) value);

  • NF
    6th Dec 2012 Member 0 Permalink

    @CaptainJL are you CaptainT?

  • jacob1
    6th Dec 2012 Developer 0 Permalink
    I fixed the first error with (float) just now, along with the other warnings I was getting. Do what boxmein said though.

    For the VINE one, get this generator.py and put it next to your source, then run it. This one takes no arguments and will work. If you don't have python, I can give you the generated files myself.

    The guide isn't completely done, I just don't know what to do about generator.py ...
  • CaptainJL
    7th Dec 2012 Member 0 Permalink

    i did the float thing (for some reason when i tried it yesterday it didnt fix (due to some function error with the std::sqrt)) but its fixed now.

    the VINE thing still is not working, i used generator.py (i do have phython) and it didnt create the files so i got the ones you posted.

    When it tryed to 'generate' after Syscalls.cpp, it gives up.

     

    @NUCLEAR_FOX no im not CaptainT.