Announcement

Collapse
No announcement yet.

PROJECT: Compiling with Dev C++ 4.9.8.0

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • PROJECT: Compiling with Dev C++ 4.9.8.0

    Originally posted by Martin Gühmann


    No need for a main.cpp. If you have have installed some "demo" version of MS VC++ (and not VBasic as you told me) then you just need to double click on the file civctp.dsw and the Visual Studio opens this project file. And then you can use the IDE to edit the files and of course to compile and link the files.

    Of course to compile and link the files you need DirectX installed.

    -Martin
    Dev C++ 4.9.8.0

    Ok, I'm giving it a shot. Big note this is the first time I've compiled a C++ program, Turbo Pascal back n 1994 was the last time I've compiled something so there maybe some real basic questions and confusion so bear with me.

    First attempt:
    Opened with civctp.dsw with DevC++ and hit execute->compile figured to strt with te basics.

    Results: of course that didn't work.

    Second attempt: Okay I started a new project in DevC++ and as I went to add files to it appears I can't select a folder and add all those files, instead I have to go into each folder and add files. Not sure if this will mess up the directories etc. But with 1000+ code files I think this may take TOO long so I'm looking for another way.
    Last edited by Ekmek; June 11, 2005, 00:47.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

  • #2
    Okay in my second attempt I started with adding all the files in the ctp2_code/ai folder and just to lear how the compiler works I tried to just compile that folder. I know it shouldn't make an exe but I wanted to see how it compiled and how the log is generated and I got 437 errors I posted the log in the attched text. Before I go crazy I'm hoping you coder guys can help explain:

    a faster way to add all the files
    if not, does nt have folders hurt?

    and please let me know if find anything of value in my error log.

    thanks!
    Attached Files
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com

    Comment


    • #3
      Well I tried Dev C++ 4.9.8.2. When I tried to import the civctp.dsp file I got an crash, but I was able to import dbgen sucessfully. The first one was about ctp2_config.h. Error meassage:

      Unsupported build environment.

      However I think on windows the content of config_win32.h should be ok. So I included it into the else block of ctp2_config.h for testing purposes.

      However another observation is that there is no config.h. So that the code doesn't compile if HAVE_CONFIG_H is defined.

      After that I got problems with these two lines:

      typedef signed __int64 sint64;
      typedef unsigned __int64 uint64;

      The best is I think that we get rid of them entirely. Afterwards I outcommented them dbgen was compiled. No problem.

      However it is not a good idea to rebuilt the project file from scratch E. First it is a lot of work and second it doesn't work, because of such MS specific stuff. I think this sint64 stuff can be removed easily as it isn't used used (I hope), but there is more stuff that we have to consider.

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

      Comment


      • #4
        Originally posted by Martin Gühmann
        Well I tried Dev C++ 4.9.8.2. When I tried to import the civctp.dsp file I got an crash, but I was able to import dbgen sucessfully. The first one was about ctp2_config.h. Error meassage:

        Unsupported build environment.

        However I think on windows the content of config_win32.h should be ok. So I included it into the else block of ctp2_config.h for testing purposes.

        However another observation is that there is no config.h. So that the code doesn't compile if HAVE_CONFIG_H is defined.
        HAVE_CONFIG_H is a define by gnu autotools when you create a config.h with autoheader. For windows, config_win32.h should be fine and HAVE_CONFIG_H should not be used, unless you are using autotools for compilation.

        typedef signed __int64 sint64;
        typedef unsigned __int64 uint64;
        The int64 types are used quite some times, e.g. for improvements (citydata.cpp, serialisation etc.). So they are used and i remember some cases where i had to append ULL to large constants to make gcc recognize them as 64bit integers. I don't know DevC++, but it says it uses the GNUCC, so chances are great you have a stdint.h header in system include path.

        Revert your changes and try changing ctp2_code/os/include/ctp2_inttypes.h that way:
        Code:
        #if defined(WIN32)
        to
        #if defined(_MSC_VER)
        I intended this first, but thought maybe other win32 compilers could use the same config again, so WIN32 is in the ifdef.

        In config_win32.h, append the following:
        Code:
        #if defined(__GNUC__) && !defined(HAVE_STDINT_H)
        #define HAVE_STDINT_H 1
        #endif
        #if defined(__GNUC__) && !defined(HAVE_INTTYPES_H)
        #define HAVE_INTTYPES_H 1
        #endif
        If this works, commit. :-)

        The best is I think that we get rid of them entirely. Afterwards I outcommented them dbgen was compiled. No problem.

        However it is not a good idea to rebuilt the project file from scratch E. First it is a lot of work and second it doesn't work, because of such MS specific stuff. I think this sint64 stuff can be removed easily as it isn't used used (I hope), but there is more stuff that we have to consider.
        -Martin
        Well, that's exactly what's done for the linux port, but it uses GNU autoconf, automake and libtool. So theoretically, you could start with cygwin trying to compile it.
        However I think Mingw32 does not include these packages, so for other compilers (borland c++, mingw32, openwatcom, etc.) you need specific makefiles.

        [edit:] HAVE_CONFIG_H will be defined if you use Cygwin with gcc and libtool installed and run ./autogen.sh ; ./configure ; make sequence.
        Last edited by ctplinuxfan; June 12, 2005, 08:52.

        Comment


        • #5
          Originally posted by E
          Okay in my second attempt I started with adding all the files in the ctp2_code/ai folder and just to lear how the compiler works I tried to just compile that folder. I know it shouldn't make an exe but I wanted to see how it compiled and how the log is generated and I got 437 errors I posted the log in the attched text. Before I go crazy I'm hoping you coder guys can help explain:

          a faster way to add all the files
          if not, does nt have folders hurt?

          and please let me know if find anything of value in my error log.

          thanks!
          You can checkout branches/linux and look in the Makefile.am files. They contain the sourcesfiles excerpted of the civctp.dsp Project relative to the directory where the Makefile.am you view is located. If you add all these by copy and paste and fix leading pathes, you should have all files of the project.

          In ctp2_code/os/autoconf/Makefile.common is a Makefile for inclusion which contains common flags which will be used by the Makefile.am later on.

          You could put something like this into your Makefile (_LDFLAGS still need the .lib files to be linked against)
          Code:
          # relative or absolute path to the ctp2_code directory of the source code
          ctp2_code=C:/ctp2_source/ctp2_code
          
          include $(ctp2_code)/os/win32/Makefile.config
          with a Makefile.config like this:
          Code:
          # Change as needed
          DIRECTX_SDKDIR=C:/DX70SDK
          DXMEDIA_SDKDIR=C:/DXMEDIA
          
          # Hopefully need no changes here except adding the libs needed
          DIRECTX_INCLUDES=$(DIRECTX_SDKDIR)/Include
          DIRECTX_LDFLAGS=-L$(DIRECTX_SDKDIR)/libs
          DXMEDIA_INCLUDES=$(DXMEDIA_SDKDIR)/Include
          DXMEDIA_LDFLAGS=-L$(DXMEDIA_SDKDIR)/libs
          
          include $(ctp2_code)/os/autoconf/Makefile.common
          
          CPPFLAGS=$(CTP2_CPPFLAGS)
          CFLAGS=-fms-extensions $(CTP2_CPPFLAGS) $(CTP2_CFLAGS)
          CXXFLAGS=-fms-extensions $(CTP2_CPPFLAGS) $(CTP2_CXXFLAGS)
          LDFLAGS=$(CTP2_LDFLAGS)
          I don't know how mingw32 handles file seperators, perhaps you need to replace slashes (/) with backslashes (\) or even with two backslashes (\\). At least this should reduce the file not found errors to somewhat at 0...

          Comment

          Working...
          X