News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Problem building ttmath library in 64 bit Windows.

Started by Zachary1234, October 23, 2018, 03:55:35 AM

Previous topic - Next topic

Zachary1234

I am running 64 bit Windows 10 Home edition.  I am using the 64 bit TDM C++ compiler.
I am running Code::Blocks 17.12.

I am trying to compile a 64 bit .dll file for the ttmath library.

I have imported all source files and all headers.  There are no further dependencies.
Code::Blocks seems to insist on importing any header and source directories
into separate folders named Sources and Headers.

So now, for reasons I cannot repair, it seems that certain #include statements
fail to find certain .h files.  Can someone reply to me, telling me how
to get this to compile (build) the .dll while detecting the .h files,
which are in fact present?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

oBFusCATed

QuoteIt does not need to be compiled first because the whole library is written as the C++ templates.
Have you read this in the main ttmath page?
This means that the library is header only, so there isn't anything you can put in a dll.
You just include it in your executable project, set the correct search path for the compiler (project -> build options -> search path -> compiler) and you're done.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Zachary1234

-I have tried doing this too, but the only thing that it gives me is the same four errors;
that apparently four files in the samples directory can't find ttmath.h,
a situation that I don't know how to rectify.  I'm getting the same error
messages as in the attached images.  What do I do to fix things from here?

oBFusCATed

Quote from: oBFusCATed on October 23, 2018, 10:29:01 AM
You just include it in your executable project, set the correct search path for the compiler (project -> build options -> search path -> compiler) and you're done.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Zachary1234

I have done this, and am know getting reams of errors.  I believe they are all preprocessing ones.

Nonetheless, I have seem to come as close as either just 4 error messages, failing to detect four .h files,
or reams of (I've no idea).  Is there yet a way to surmount these problems?

stahta01

#6
Quote from: Zachary1234 on October 29, 2018, 10:58:54 AM
I have done this, and am know getting reams of errors.  I believe they are all preprocessing ones.

Nonetheless, I have seem to come as close as either just 4 error messages, failing to detect four .h files,
or reams of (I've no idea).  Is there yet a way to surmount these problems?

Once you learn how to post a CB build log, you should find a website to help you learn how to program.
This website is not an how to program website.

Edit: TTMATH_NOASM define stops it from trying to use the assembly code that is giving errors.
Edit2: I am guessing the 64 bit build is not compatible with MinGW GCC; likely need Linux or maybe Cygwin GCC for 64 bit builds.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

Quote from: stahta01 on October 29, 2018, 12:39:28 PM
Once you learn how to post a CB build log, you should find a website to help you learn how to program.
This website is not an how to program website.

Edit: TTMATH_NOASM define stops it from trying to use the assembly code that is giving errors.
Edit2: I am guessing the 64 bit build is not compatible with MinGW GCC; likely need Linux or maybe Cygwin GCC for 64 bit builds.

Tim S.

You might try reading or posting on https://www.ttmath.org/forum

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#8
Quote from: stahta01 on October 29, 2018, 08:43:37 PM
Quote from: stahta01 on October 29, 2018, 12:39:28 PM
Once you learn how to post a CB build log, you should find a website to help you learn how to program.
This website is not an how to program website.

Edit: TTMATH_NOASM define stops it from trying to use the assembly code that is giving errors.
Edit2: I am guessing the 64 bit build is not compatible with MinGW GCC; likely need Linux or maybe Cygwin GCC for 64 bit builds.

Tim S.

You might try reading or posting on https://www.ttmath.org/forum

Tim S.

Read at least this post https://www.ttmath.org/forum/can_t_build_samples_in_samples_directory._using_windows_10_and_mingw64

Edit: On rereading that post does not help very much.

Edit2: Link to code fix for svn trunk https://www.ttmath.org/forum/patch_for_building_64_bit_using_windows_mingw64_gcc

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Zachary1234

-I am back to the point in my original post, where 4 of my includes inside the samples
directory cannot find ttmath.h

-I have used the Windows path variable, as well as the Code::Blocks
build options search directories, still to no success.

-I am using version 0.9.3 of ttmath.

-What is the one little thing I clearly need to fix so that
these #include statements can pick up ttmath.h ?

stahta01

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Zachary1234

Is this particular build log attachment of any further explanatory use?

stahta01

#12
So, do you want to add the project search path so the project can find the header?

If you do not know how, state that!

Edit: You should only try to build one sample C++ file per target/project till you get that one to work.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

stahta01

#13
Remember to fix the ttmath library code!

Edit: Attached my test project as an zip file.


Index: ttmath/ttmathtypes.h
============================================================ =======
--- ttmath/ttmathtypes.h (revision 1132)
+++ ttmath/ttmathtypes.h (working copy)
@@ -235,13 +235,13 @@
/*!
on 64bit platforms one word (uint, sint) will be equal 64bits
*/
- typedef unsigned long uint;
+ typedef uint64_t uint;

/*!
on 64bit platforms one word (uint, sint) will be equal 64bits
*/
- typedef signed long sint;
- #endif
+ typedef int64_t sint;
+ #endif

/*!
on 64bit platforms we do not define ulint and slint


Edit2: Shows where the CB Project should be extracted

$ ls ttmath-0.9.3
bin/  CHANGELOG  COPYRIGHT  README  samples/  ttmath/  ttmath.cbp  ttmath.zip


Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

Zachary1234

#14
#include "ttmathbig.h"
#include "ttmathobjects.h"

- typedef unsigned long uint;
+ typedef uint64_t uint;

- typedef signed long sint;
- #endif
+ typedef int64_t sint;
+ #endif

I have made all these changes, and I am still getting the same compilation errors such
as I posted at the very beginning.  I am still getting the same 4 errors that cannot see
my 4 ttmath.h #include statements.  What can I do to repair this?


fatal error ttmath/ttmath.h: No such file or directory