Announcement

Collapse
No announcement yet.

COMPILE: Getting the source to compile

Collapse
This is a sticky topic.
X
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • COMPILE: Getting the source to compile

    OK, I've had some success getting the source to compile. Here's a quick summary of what I had to do:

    Firstly, download both the DirectX things as mentioned in the readme, and set up the VC++ paths as mentioned.

    Set up the environment variable as instructed in the readme, and then reboot (Otherwise the change will not be noticed).

    I worked with the workspace ctp2_code\ctp\civctp.dsw in MSDev (That is the MS Visual C++ IDE) from MS Visual Studio 6.0.

    The next thing that went wrong was that none of the custom build instructions using flex or byacc worked, so I had to copy/paste out the command lines and do them myself at a command prompt (You can find the command lines it is trying to run by right-clicking on the file it's trying to build, choosing "Settings..." and going to the "Custom Build" tab).

    After that, the lack of miles sound system is the next problem. This is referenced in civsound.h, and I think the best solution is to rewrite the CivSound class with stub methods. I haven't got the time to do that, because I have to get to bed, but I'll try to find some more time tomorrow.

    Any other suggestions are welcome.
    Last edited by J Bytheway; October 28, 2003, 21:26.

  • #2
    To supplement John's post, here's what you need to get the file to compile (up until the point where you get Miles Sound System errors):

    1) Download and extract the sourcecode. Get it here: http://apolyton.net/ctp2/files/CTP2_Source.exe (8 MB)

    2) Download the two required DirectX SDKs.
    The first one is here: http://www.microsoft.com/downloads/d...displaylang=en (186 MB)
    The second one is here: http://www.microsoft.com/downloads/d...C-E7D710E18522 (92 MB)

    3) Set up the environment variable (CDKDIR). See readme (Control Panel->System->Environment Variables). Then reboot.

    4) Open the project file of the source code(ctp2_code\ctp\civctp.dsw) in Microsoft Visual Studio 6. Other compilers may work as well, but this is untested.

    5) Make sure you add the Include and Lib and classes/base directories from the DirectX SDKs to Tools->Options->Directories from Visual Studio, as described in the readme.

    6) Build the flex and byacc files manually, as described by John.

    7) Compile the code. Should give 101 errors and 5 warnings. This is the point where CivSound needs to be replaced by a stub (empty code).
    Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

    Comment


    • #3
      Or, if you're on a crappy modem connection on a crappy ISP and only need the actual DirectX 7 C++ build files (without samples, help etc) then you can download the minimal version of 400kb (instead of 186meg) from here.....

      http://alleg.sourceforge.net/files/dx70_min.zip

      Comment


      • #4
        .Net is more interesting...

        I found the following...

        1) The Flex and Bison build commands
        a) Don't like embedded spaces
        b) the "s are in the wrong spaces.

        You need to install to a path without embedded spaces, and look closely at where the "s are. Some need to be removed or moved.

        2) replace references to the include file List-fixed with references to List.

        3) there's a new keyword called typename, required for the templates.

        4) Scheduler has some redundency issues. It look like moving s_Schedulers into the .cpp file resolves this.

        5) Many math functions now cause redundancy errors. At least one of these looks like it hid a bug
        Taking the (Ceil of an Int/Int will always do a floor instead)

        6) It looks like the custom allocation for the STL has changed slightly.

        Ralph

        Comment


        • #5
          Originally posted by RalphTrickey
          .Net is more interesting...

          I found the following...

          1) The Flex and Bison build commands
          a) Don't like embedded spaces
          b) the "s are in the wrong spaces.

          You need to install to a path without embedded spaces, and look closely at where the "s are. Some need to be removed or moved.

          2) replace references to the include file List-fixed with references to List.

          3) there's a new keyword called typename, required for the templates.

          4) Scheduler has some redundency issues. It look like moving s_Schedulers into the .cpp file resolves this.

          5) Many math functions now cause redundancy errors. At least one of these looks like it hid a bug
          Taking the (Ceil of an Int/Int will always do a floor instead)

          6) It looks like the custom allocation for the STL has changed slightly.

          Ralph
          Do I sense two variants of Open Source CTP2 arising already?

          Comment


          • #6
            Something I found out is that the custom build steps don't like spaces in your path, like RalphTrickey said. I had the following error when building: "C:/Documents" not found. Or something along these lines. The solution was to copy the bison and yacc files into a folder with no spaces, like "C:\cdk_dir" and put that into the CDKDIR environment variable.

            The next problem was that my sources were also in a path with spaces in it. And sure enough yacc didn't like it... And sure enough, into a directory with no spaces the source went. That's a bit of copying around, but hey, I didn't have to do the yacc and bison stuff manually.

            EDIT: Update: All of the projects except for ctp2 compiled cleanly. As for the ctp2 one... Heh... It's going... But I've seen so many errors, it's not even funny, I'll update with the number, when it comes up.

            Update2: The thing's finally done with the first run of compilation... I could only dream of 101 Errors. 732 Errors and 1264 warnings here. Most are in ctp2_code/ai/list-fixed.... Guess I'll just include the list header I have on my machine for now and see what happens. Any way, like RalphTrickey said, it's definitely a little more complicated on VS.NET, which is also what I have. I'll post a detailed list of what needs to be done when I get down to 101 errors.
            Last edited by vovan; October 29, 2003, 01:48.
            XBox Live: VovanSim
            xbox.com (login required)
            Halo 3 Service Record (I fail at FPS...)
            Spore page

            Comment


            • #7
              Okay, the problem I have now, is somehow the STL doesn't want to play.... I get a lot of errors like this:

              c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\deque(59): error C2027: use of undefined type 'Scheduler'

              Though you'd think it should work, somehow it doesn't. This is beyond me, at least at one o'clock in the morning, so I'm going to bed. If anyone has any ideas as to why I might be having problems with STL, feel free to point out.
              XBox Live: VovanSim
              xbox.com (login required)
              Halo 3 Service Record (I fail at FPS...)
              Spore page

              Comment


              • #8
                Hmm... I was careful to install to a path without spaces, so that couldn't ve the source of my flex/bison problems...

                Comment


                • #9
                  This is one great thread. I will now try to get the souce at least to the 101 error point at this computer.
                  Solver, WePlayCiv Co-Administrator
                  Contact: solver-at-weplayciv-dot-com
                  I can kill you whenever I please... but not today. - The Cigarette Smoking Man

                  Comment


                  • #10
                    How do I solve this?

                    --------------------Configuration: ctp2 - Win32 Debug Browse--------------------
                    Performing Custom Build Step on ..\ui\ldl\ldl.y
                    k:\Activision\CTP2Source\bin\byacc: f - cannot open "/tmp/yacc.aa01116"
                    Error executing c:\windows\system32\cmd.exe.

                    CivCTP_dbg.exe - 1 error(s), 0 warning(s)
                    Last edited by DDowell; October 29, 2003, 11:05.
                    So much to do in so little time...

                    Comment


                    • #11
                      DDowell,
                      Sounds like the Custom Build Steps problem John described. Did you try compiling manually?
                      Administrator of WePlayCiv -- Civ5 Info Centre | Forum | Gallery

                      Comment


                      • #12
                        Does anyone know what the difference is between a "Debug" build and a "Debug Browse" build - I was doing the former but I see that DDowell was doing the latter...

                        Comment


                        • #13
                          Originally posted by RalphTrickey
                          .Net is more interesting...

                          I found the following...

                          1) The Flex and Bison build commands
                          a) Don't like embedded spaces
                          b) the "s are in the wrong spaces.
                          What do you mean by the latter - there aren't any "s in the Flex and Bison build commands, are there? They look something like:

                          Code:
                          $(CDKDIR)\flex -i -o$(ProjDir)\lex.yy.c $(InputPath)

                          Comment


                          • #14
                            Originally posted by ahenobarb
                            Do I sense two variants of Open Source CTP2 arising already?
                            Hopefully we can use #ifdefs to make a version which will compile under both conditions (not to mention gcc, too, but that will probably take rather longer)

                            Comment


                            • #15
                              I'm chainposting again, but I can't help it...

                              One of the things in the CivSound class is

                              Code:
                              HAUDIO			m_hAudio;
                              Now, the HAUDIO type was defined in mss.h (or one of its dependancies) so if I want to nullify the methods of CivSound without altering it too much I need to redefine it as something else which is recognized. Should I just use uint32, or does someone else have a better idea? The size of the type might matter, but hopefully it won't...

                              Comment

                              Working...
                              X