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

  • Thanks Fromafar.

    Originally posted by Fromafar

    The warnings for dbgen are Microsoft inventions. Adding _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS to the preprocessor definitions should get rid of those.
    This worked, dbgen is fine now.

    The single warning with each map generator can be solved by removing 1 line from the Module Definition file. I will add the modified file to the archive.
    I updated all my files to the latest revision (882) but I still get the same "warning LNK4017" warning.

    It looks like there are only 2 main errors when compiling ctp2.
    Firstly, you have to check some of the database files (specifically: RiskRecord, PollutionRecord, and MapRecord). It looks like these have not been (re)generated correctly.
    I'll take a look, but I don't know what I'm looking for.

    Secondly, there are some errors in refclock.h. Those are probably caused by your manual mixing of new Windows Platform SDK and old DXSDK files. Better remove the borrowed files, and check that your include and library paths are correct and complete.
    Apparently dinput.h and dsound.h are not included in the Windows SDK, they're only in the DirectX SDK. I will have to install the DXSDK alongside the Windows SDK. Then I'll have to figure out which folders to use.

    The Windows SDK readme doesn't make any mention of uninstalling DXSDK to install the Windows SDK (only earlier Platform SDK'S), so it should be fine.
    Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
    CtP2 AE Wiki & Modding Reference
    One way to compile the CtP2 Source Code.

    Comment


    • Originally posted by Maquiladora
      I updated all my files to the latest revision (882) but I still get the same "warning LNK4017" warning.
      This is what I have found so far:


      But since it is just a warning, you can ignore it for now.


      Originally posted by Maquiladora
      I'll take a look, but I don't know what I'm looking for.
      Well you could look for the files in the newdb folder and look whether all the Record files are there.

      Originally posted by Maquiladora
      Apparently dinput.h and dsound.h are not included in the Windows SDK, they're only in the DirectX SDK. I will have to install the DXSDK alongside the Windows SDK. Then I'll have to figure out which folders to use.
      That's how I did it. Here is what I have at the top of the include directories:

      D:\DirectX_SDK_Oct_2006\Include
      D:\Programme\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\Ba seClasses

      And here are the lib directories:

      D:\DirectX_SDK_Oct_2006\Lib\x86
      D:\Programme\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\Ba seClasses\Debug

      Maybe the subdirectories are different, that may be, because I have here the last DirectX version that is supposed to support Win98.

      -Martin
      Civ2 military advisor: "No complaints, Sir!"

      Comment


      • Originally posted by Martin Gühmann

        Well you could look for the files in the newdb folder and look whether all the Record files are there.
        Risk has:

        Risk.cdb
        RiskRecord.cpp
        RiskRecord.h

        Pollution and Map has the same three names and types.

        But most others also have .old files, and some have .stamp.

        That's how I did it. Here is what I have at the top of the include directories:
        That is how mine looked when I last compiled.

        Now I'm down to 224 errors and no warnings for ctp2. The 10 errors and 1 warning related to refclock.h were fixed. So now only these risk/pollution/map database problems remain.
        Last edited by Maquiladora; August 6, 2008, 18:05.
        Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
        CtP2 AE Wiki & Modding Reference
        One way to compile the CtP2 Source Code.

        Comment


        • Originally posted by Maquiladora
          So now only these risk/pollution/map database problems remain.
          Well you could create those files manually again. To do it go to Visual Studio look at the file tree and find the newdb files. There you have in the list the cdb files. Right click on these files and compile and see what happens.

          -Martin
          Civ2 military advisor: "No complaints, Sir!"

          Comment


          • Originally posted by Martin Gühmann

            Well you could create those files manually again. To do it go to Visual Studio look at the file tree and find the newdb files. There you have in the list the cdb files. Right click on these files and compile and see what happens.
            They all compiled fine. I'm trying to compile ctp2 again now.

            EDIT: Well it looks like I already still have the same problems as before.
            Last edited by Maquiladora; August 6, 2008, 18:28.
            Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
            CtP2 AE Wiki & Modding Reference
            One way to compile the CtP2 Source Code.

            Comment


            • Can you check whether, the corresponding, *.cpp and *.h are present in the newdb folder in Visual Studio. And can you compare the properties of the *.cdb files in question with those that are ok?

              -Martin
              Civ2 military advisor: "No complaints, Sir!"

              Comment


              • Originally posted by Martin Gühmann
                Can you check whether, the corresponding, *.cpp and *.h are present in the newdb folder in Visual Studio.
                They are present.

                And can you compare the properties of the *.cdb files in question with those that are ok?
                They look the same. Map doesn't have dbgen.exe as a dependency like Pollution and Risks, but some other files don't have a dependency either. Apart from that nothing is different.

                There is not a lot of options there anyway. Just configuration properties (general 2 options), and custom build step (general 4 options).
                Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                CtP2 AE Wiki & Modding Reference
                One way to compile the CtP2 Source Code.

                Comment


                • Well, for now I have no more ideas, maybe Fromafar has some. But of course the must be a solution for the problem since the other databases work and I don't have any problems with that.

                  EDIT: Well, I could try again to convert the workspace and see what happens, but not today.

                  -Martin
                  Last edited by Martin Gühmann; August 6, 2008, 18:57.
                  Civ2 military advisor: "No complaints, Sir!"

                  Comment


                  • Well, maybe there went something wrong with the VC6 workspaces, or I did something after conversion that I forgot.

                    So here are the civctp.vcproj and the civctp.sln.

                    -Martin
                    Attached Files
                    Civ2 military advisor: "No complaints, Sir!"

                    Comment


                    • Originally posted by Martin Gühmann
                      Well, maybe there went something wrong with the VC6 workspaces, or I did something after conversion that I forgot.

                      So here are the civctp.vcproj and the civctp.sln.
                      I got the same number and type of errors. Thanks for trying though.

                      I'll wait another day and then perhaps I should try a fresh install and update of the code.
                      Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                      CtP2 AE Wiki & Modding Reference
                      One way to compile the CtP2 Source Code.

                      Comment


                      • Originally posted by Maquiladora
                        I updated all my files to the latest revision (882) but I still get the same "warning LNK4017" warning.
                        Updating the files is not enough. You have to modify the Linker settings to use the new file (MapGenerator.def) instead of the current ones (Crater.def etc.) for each project.

                        I dug up some old notes about the database generation stuff. Maybe this will help:


                        Notes on custom build steps for Microsoft Visual Studio 2005

                        1. Add custom build rules

                        Menu Tools|Options|Projects and Solutions|VC++ Project Settings|Rule File Search Paths: add \ctp2_code\compiler\msvc8.
                        Select the ctp2 project, right-click, select Custom Build Rules. Tick the boxes "Ctp2 Code Generation", "Scanner Generation", "Parser Generation".
                        Same for the dbgen project, but only "Scanner Generation" and "Parser Generation".

                        2. Use custom build rules

                        Select a .cdb file, right-click, select Properties. For Configuration Properties|General|Tool, choose CtP2 Database Code Generator from the drop-down list.
                        For .l files, choose Scanner Generator. Fill in the Unique Name part (default "yy" generates lex.yy.c, set to "sc" for sliccmd.l, "dbl" for DBLexer.l, "ldl" for ldl.l) when needed.
                        For .y files, choose Parser Generator. Fill in the Unique Name Part (default: "y" generates y.tab.h + y.tab.c, set to "sc" for sliccmd.y, "ldl" for ldl.y) and Directory (default: not needed, set to "..\\gs\\slic\\" for slic.y and sliccmd.y, "..\\ui\\ldl\\" for ldl.y) when needed.

                        3. Verification

                        Select a .cdb/.l/.y file, right-click, select Compile. In the build output window you should see something like "Generating database code/scanner/parser for <selected file>".

                        4. Problem solving

                        When the database generation looks OK (both "Generating database code for <whatever>.cdb" and "<whatever>Record.cpp" appear without errors in the build output window), but there are errors compiling files that #include the generated code, check the ctp2_code\gs\database directory for remainders of obsolete old format files, and remove these manually. The vcproj file is not maintained in Subversion.

                        Comment


                        • Originally posted by Fromafar
                          Updating the files is not enough. You have to modify the Linker settings to use the new file (MapGenerator.def) instead of the current ones (Crater.def etc.) for each project.
                          Cab the MapGenerator.def file be used in MSVC6 or is that some Microsoft compiler version specific stuff. Well, maybe I just should try the file on MSVC6.

                          Originally posted by Fromafar
                          4. Problem solving

                          When the database generation looks OK (both "Generating database code for <whatever>.cdb" and "<whatever>Record.cpp" appear without errors in the build output window), but there are errors compiling files that #include the generated code, check the ctp2_code\gs\database directory for remainders of obsolete old format files, and remove these manually. The vcproj file is not maintained in Subversion.
                          Maybe this is the problem, the code downloaded from the repository is free of those old files, but if you put the code from the repository onto a previous installation of the code then you have problems.

                          -Martin
                          Civ2 military advisor: "No complaints, Sir!"

                          Comment


                          • Originally posted by Fromafar

                            Updating the files is not enough. You have to modify the Linker settings to use the new file (MapGenerator.def) instead of the current ones (Crater.def etc.) for each project.
                            Thanks, they're all fine now.

                            So the 4 mapgen files and dbgen are compiling without errors or warnings.

                            4. Problem solving

                            When the database generation looks OK (both "Generating database code for <whatever>.cdb" and "<whatever>Record.cpp" appear without errors in the build output window), but there are errors compiling files that #include the generated code, check the ctp2_code\gs\database directory for remainders of obsolete old format files, and remove these manually. The vcproj file is not maintained in Subversion.
                            It seems this was the problem.

                            I took the lazy route and moved all the old (not modified by the repository) files out of the folder and compiled and got no warnings and only 1 error on ctp2:

                            .\ctp2_rsrc\civ3.rc(10) : fatal error RC1015: cannot open include file 'afxres.h'.
                            I found my afxres.h file in two folders:

                            \Microsoft SDKs\Windows\v6.1\Samples\winui\TSF\tsfapp
                            \Microsoft SDKs\Windows\v6.1\Samples\winui\TSF\tsfcompart

                            I added the first directory to my include directories (below DXSDK, BaseClasses, and WinSDK), and civ3.rc compiled without errors.

                            I tried compiling the whole thing again (thinking it should work now), but I got 1 error:

                            LINK : fatal error LNK1181: cannot open input file 'dinput.lib'
                            I searched for the file but didn't have it anywhere, I only have dinput8.lib in my DXSDK\lib\x86 folder.

                            I'll have to stop for now though. Any suggestions on how best I should fix this?

                            I've attached my last full build log.
                            Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                            CtP2 AE Wiki & Modding Reference
                            One way to compile the CtP2 Source Code.

                            Comment


                            • The log
                              Attached Files
                              Call to Power 2: Apolyton Edition - download the latest version (12th June 2011)
                              CtP2 AE Wiki & Modding Reference
                              One way to compile the CtP2 Source Code.

                              Comment


                              • Originally posted by Maquiladora
                                I searched for the file but didn't have it anywhere, I only have dinput8.lib in my DXSDK\lib\x86 folder.

                                I'll have to stop for now though. Any suggestions on how best I should fix this?
                                In that case you should go some posts back :

                                Originally posted by Martin Gühmann
                                That's how I did it. Here is what I have at the top of the include directories:

                                D:\DirectX_SDK_Oct_2006\Include
                                D:\Programme\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\Ba seClasses

                                And here are the lib directories:

                                D:\DirectX_SDK_Oct_2006\Lib\x86
                                D:\Programme\Microsoft SDKs\Windows\v6.1\Samples\Multimedia\DirectShow\Ba seClasses\Debug
                                So you see the lib folder is included.

                                -Martin
                                Civ2 military advisor: "No complaints, Sir!"

                                Comment

                                Working...
                                X