# Code::Blocks

## User forums => Using Code::Blocks => Topic started by: Zachary1234 on October 23, 2018, 03:55:35 am

Title: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 23, 2018, 03:55:35 am
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?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 23, 2018, 10:03:02 am
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: oBFusCATed on October 23, 2018, 10:29:01 am
Quote
It 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.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 29, 2018, 06:05:51 am
-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?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: oBFusCATed on October 29, 2018, 08:44:57 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.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: 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?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 29, 2018, 12:39:28 pm
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.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 29, 2018, 08:43:37 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 (https://www.ttmath.org/forum)

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 29, 2018, 08:45:31 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 (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 (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 (https://www.ttmath.org/forum/patch_for_building_64_bit_using_windows_mingw64_gcc)

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 01:22:42 am
-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 ?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 01:42:29 am
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Till you learn how to post a build log; I see no way anybody can ever help you.

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 02:12:17 am
Is this particular build log attachment of any further explanatory use?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 02:28:30 am
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.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 03:03:35 am
Remember to fix the ttmath library code!

Edit: Attached my test project as an zip file.

Code: [Select]
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
Code: [Select]
\$ ls ttmath-0.9.3bin/  CHANGELOG  COPYRIGHT  README  samples/  ttmath/  ttmath.cbp  ttmath.zip
Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 04:51:22 am
#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
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 04:53:52 am
Add the search path to the include folder!

Edit1: Or you can use my project that has the search path already added; note you have to extract the project to the correct location!

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 05:04:09 am
I have done this and I am still getting my four errors.  Is there anything else that I can do?

-------------- Build: Release in Numbers (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\User\Desktop\ttmath-0.9.3\ttmath -c C:\Users\User\Desktop\ttmath-0.9.3\samples\big.cpp -o obj\Release\ttmath-0.9.3\samples\big.o
g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\User\Desktop\ttmath-0.9.3\ttmath -c C:\Users\User\Desktop\ttmath-0.9.3\samples\big2.cpp -o obj\Release\ttmath-0.9.3\samples\big2.o
g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\User\Desktop\ttmath-0.9.3\ttmath -c C:\Users\User\Desktop\ttmath-0.9.3\samples\int.cpp -o obj\Release\ttmath-0.9.3\samples\int.o
g++.exe -Wall -fexceptions -O2 -m64 -IC:\Users\User\Desktop\ttmath-0.9.3\ttmath -c C:\Users\User\Desktop\ttmath-0.9.3\samples\parser.cpp -o obj\Release\ttmath-0.9.3\samples\parser.o
C:\Users\User\Desktop\ttmath-0.9.3\samples\parser.cpp:1:27: fatal error: ttmath/ttmath.h: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))

C:\Users\User\Desktop\ttmath-0.9.3\samples\big2.cpp:1:27: fatal error: ttmath/ttmath.h: No such file or directory
C:\Users\User\Desktop\ttmath-0.9.3\samples\big.cpp:1:27: fatal error: ttmath/ttmath.h: No such file or directory
C:\Users\User\Desktop\ttmath-0.9.3\samples\int.cpp:1:27: fatal error: ttmath/ttmath.h: No such file or directory
compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))

compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))

compilation terminated.
Process terminated with status 1 (0 minute(s), 0 second(s))
4 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 05:06:09 am
Enter the correct path.
-IC:\Users\User\Desktop\ttmath-0.9.3\ttmath Wrong
-IC:\Users\User\Desktop\ttmath-0.9.3            Right

Quote
Project -> Build Options
Make sure project is selected in left hand pane
Tab: Search Directory
Sub-Tab: Compiler
Click on folder open icon
Enter path of "C:\Users\User\Desktop\ttmath-0.9.3" without double quotes in text box next to "Folder:"
Click on OK
Click "Yes" to keep this relative

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 05:20:21 am
I have done this and am still getting the following errors:
Is there a simple solution to what is going on?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 05:22:48 am
I have done this and am still getting the following errors:
Is there a simple solution to what is going on?

You failed to edit the program header file correctly.
I have no idea how little you know; I thought you would either know what a patch file meant or ask what it meant.

- means remove this line

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 05:35:02 am
I have made the following changes, commenting out and replacing:

- typedef unsigned long uint;
+ typedef uint64_t uint;

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

Are these the only removes and add changes, in these places,
inside ttmathtypes.h, that I need to make?

I am still getting three little errors left in ttmathtypes.h,
on lines 181, 202 and 236.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 05:42:39 am
I have made the following changes, commenting out and replacing:

- typedef unsigned long uint;
+ typedef uint64_t uint;

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

Are these the only removes and add changes, in these places,
inside ttmathtypes.h, that I need to make?

I am still getting three little errors left in ttmathtypes.h,
on lines 181, 202 and 236.

I have no idea what you did so; I can not help you undo it.

I will attach the edited file because I am afraid you have no idea what to do to edit it.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 05:51:31 am
That's fine, and the file that you just uploaded does coincide.

I am now getting those 3 errors inside the file

ttmathmisc.h

at three function declarations on lines 181,202 and 236.

What should I do about them?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 05:52:29 am
That's fine, and the file that you just uploaded does coincide.

I am now getting those 3 errors inside the file

ttmathmisc.h

at three function declarations on lines 181,202 and 236.

What should I do about them?

POST THE ERRORS IN CODE TAGS OR GO AWAY!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 05:54:54 am

-------------- Build: Release in Numbers (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -O2 -m64 -I..\ttmath-0.9.3 -c C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h -o ..\ttmath-0.9.3\ttmath\ttmathmisc.h.gch
g++.exe -Wall -fexceptions -O2 -m64 -I..\ttmath-0.9.3 -c C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathobjects.h -o ..\ttmath-0.9.3\ttmath\ttmathobjects.h.gch
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:181:8: error: 'uint' does not name a type
static uint CharToDigit(uint c)
^
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:202:8: error: 'sint' does not name a type
static sint CharToDigit(uint c, uint base)
^
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:236:8: error: 'uint' does not name a type
static uint DigitToChar(uint digit)
^
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 05:58:34 am
STOP USING PRECOMPILED HEADERS; you do not know enough to use them right.

Find and delete this file "ttmathobjects.h.gch" The gch is the file extension GCC uses for Precompiled Headers (PCH).

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:01:08 am
I give up I have never spent this much time with a newbie who can not learn to use code tags.
Do you just ignore the links I post?

Goodbye.

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 06:02:39 am
I don't mean to be a pain, it's just that I'm trying to build this library from source in 64 bit mode,
and for reasons I havn't been sure about I'm trying to eliminate the remaining build errors.
I'm just not familar with hour this particular code base, the ttmath library, is coded.

The file ttmathobjects.h.gch does not exist to be deleted, which brings me up to date with you.

-------------- Build: Release in Numbers (compiler: GNU GCC Compiler)---------------

g++.exe -Wall -fexceptions -O2 -m64 -I..\ttmath-0.9.3 -c C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h -o ..\ttmath-0.9.3\ttmath\ttmathmisc.h.gch
g++.exe -Wall -fexceptions -O2 -m64 -I..\ttmath-0.9.3 -c C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathobjects.h -o ..\ttmath-0.9.3\ttmath\ttmathobjects.h.gch
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:181:8: error: 'uint' does not name a type
static uint CharToDigit(uint c)
^
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:202:8: error: 'sint' does not name a type
static sint CharToDigit(uint c, uint base)
^
C:\Users\User\Desktop\ttmath-0.9.3\ttmath\ttmathmisc.h:236:8: error: 'uint' does not name a type
static uint DigitToChar(uint digit)
^
Process terminated with status 1 (0 minute(s), 0 second(s))
3 error(s), 0 warning(s) (0 minute(s), 0 second(s))

Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:05:37 am
STOP TRYING TO COMPILE THE HEADERS.

Remove them from the project if that is the only way you know to stop trying to compile them.

http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 06:07:58 am
Okay then.  Only including the 5 classes inside samples, I am still left with:

Code: [Select]
-------------- Build: Release in Numbers (compiler: GNU GCC Compiler)---------------g++.exe  -o bin\Release\Numbers.exe obj\Release\ttmath-0.9.3\samples\big.o obj\Release\ttmath-0.9.3\samples\big2.o obj\Release\ttmath-0.9.3\samples\int.o obj\Release\ttmath-0.9.3\samples\parser.o obj\Release\ttmath-0.9.3\samples\uint.o obj\Release\Numbers\main.o  -s -m64  obj\Release\ttmath-0.9.3\samples\big2.o:big2.cpp:(.text+0x10): multiple definition of SimpleCalculating(ttmath::Big<1ull, 2ull> const&, ttmath::Big<1ull, 2ull> const&)'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text+0x10): first defined hereobj\Release\ttmath-0.9.3\samples\big2.o:big2.cpp:(.text+0x290): multiple definition of CalculatingWithCarry(ttmath::Big<1ull, 2ull> const&, ttmath::Big<1ull, 2ull> const&)'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text+0x290): first defined hereobj\Release\ttmath-0.9.3\samples\big2.o:big2.cpp:(.text.startup+0x0): multiple definition of main'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text.startup+0x0): first defined hereobj\Release\ttmath-0.9.3\samples\int.o:int.cpp:(.text.startup+0x0): multiple definition of main'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text.startup+0x0): first defined hereobj\Release\ttmath-0.9.3\samples\parser.o:parser.cpp:(.text.startup+0x0): multiple definition of main'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text.startup+0x0): first defined hereobj\Release\ttmath-0.9.3\samples\uint.o:uint.cpp:(.text.startup+0x0): multiple definition of main'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text.startup+0x0): first defined hereobj\Release\Numbers\main.o:main.cpp:(.text.startup+0x0): multiple definition of main'obj\Release\ttmath-0.9.3\samples\big.o:big.cpp:(.text.startup+0x0): first defined herecollect2.exe: error: ld returned 1 exit statusProcess terminated with status 1 (0 minute(s), 1 second(s))5 error(s), 0 warning(s) (0 minute(s), 1 second(s)) `
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:10:31 am
And, I told not to do that!

Use only a single main function per target!

So, the problems are fixed from my viewpoint.

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:11:40 am
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.

I posted my project that had multiple targets one per sample file as a zip in this thread.

Tim S.
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: Zachary1234 on October 30, 2018, 06:14:02 am
I simply need to be able to compile a third party library, in 64 bint windows, without any errors.
I in fact shouldn't have to do all of this, from my point of view, if it is 64 bit complete.
I also don't have the time to learn their code base to fix things like this.
If there isn't any more for you to lob in, certainly from your stand point, should I simply leave this form?
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:21:10 am
You would have been better off if you knew the difference between compiler and IDE (Code::Blocks) issues.
And, you would have been better off to use the provided makefile to build the samples unless the third party is supplying Code::Blocks projects. And, you should have used the library forum to research the issue. You came across as a very lazy newbie who has large gaps in knowledge. And, it took three posts with me threatening you with banning before you took the time to use code tags.

Tim S.

Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: stahta01 on October 30, 2018, 06:25:15 am
If you decide to continue on this website read and follow the rules in the future!
http://forums.codeblocks.org/index.php/topic,9996.0.html (http://forums.codeblocks.org/index.php/topic,9996.0.html)
Title: Re: Problem building ttmath library in 64 bit Windows.
Post by: sodev on October 30, 2018, 07:58:45 pm
I simply need to be able to compile a third party library, in 64 bint windows, without any errors.
ttmath is a template header-only library you DO NOT and you CAN NOT compile it (as a DLL/library). You simply include the headers to the application and you are done!