chcpp.info will be turned off

735 views
Skip to first unread message

Christiano

unread,
May 21, 2018, 9:56:04 PM5/21/18
to PPP-public
On my website I had a list of bugs contained in the book and a working GUI library, however I can not provide the site anymore, so I will attach the files in this post.

Modified/Original files:
ch12new20170902.tar.gz: Not-official GUI library to 2nd edition (It is the GUI library 1st edition + modifications)
bugs.html: My not-official errata 2nd edition

Basic files:
std_lib_facilities.h: http://stroustrup.com/Programming/PPP2code/std_lib_facilities.h
(Chapter Numerics) MatrixIO11.h: http://stroustrup.com/Programming/PPP2code/MatrixIO11.h
(Chapter Numerics) Matrix11.h: http://stroustrup.com/Programming/PPP2code/Matrix11.h


ch12new20170902.tar.gz
bugs.html
std_lib_facilities.h
MatrixIO11.h
Matrix11.h

cortical_iv

unread,
Jun 17, 2018, 11:17:38 PM6/17/18
to PPP-public
Thanks a lot for providing this I have been looking for your web site and was worried all that work was gone!

cortical_iv

unread,
Jun 19, 2018, 10:17:50 AM6/19/18
to PPP-public

On Monday, May 21, 2018 at 9:56:04 PM UTC-4, Christiano wrote:
That fltk middleware is really amazing, I have put it into a github repository, as we discussed in the other thread:

cortical_iv

unread,
Jun 19, 2018, 2:36:16 PM6/19/18
to PPP-public

On Monday, May 21, 2018 at 9:56:04 PM UTC-4, Christiano wrote:
On my website I had a list of bugs contained in the book and a working GUI library, however I can not provide the site anymore, so I will attach the files in this post.

As of yesterday, I've started using ch12new. One weird bug I get when I try using Makefile instead of cmake is the image doesn't load and I get:
    
JPEG file "image.jpg" is too large or contains errors!


I know it isn't the file or general code, because it works with cmake. I made a repository to show the problem here:

https://github.com/cortical-iv/image_tester

It isn't a major deal but just something I thought I'd highlight for now.

Christiano SA

unread,
Jun 19, 2018, 6:06:41 PM6/19/18
to ppp-p...@googlegroups.com
It is working here, as the attached image shows.

Identifying the problem:

Run the program but don't close it.
For example:
$ ./12 &
(put the & at the end of the line so that you can get the terminal control)

The result will be something like:
$ ./12 &
[1] 764
$ JPEG file "simple_image.jpg" is too large or contains errors!

Do you see the number 764? That number is the PID number of the process "./12", it may be different when you try it.
after (while the program is running), do this:
press Enter:
$ pwdx 764
(Remember, Your PID number may be different than 764)

Result:
764: /home/ch/Downloads/gui/ch12new

The pwdx will show the current working directory of the process, so you can see if it is correct.

> Sent: Tuesday, June 19, 2018 at 3:36 PM
> From: cortical_iv <thomso...@gmail.com>
> To: PPP-public <ppp-p...@googlegroups.com>
> Subject: Re: chcpp.info will be turned off
> --
> You received this message because you are subscribed to the Google Groups "PPP-public" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to ppp-public+...@googlegroups.com.
> To post to this group, send email to ppp-p...@googlegroups.com.
> Visit this group at https://groups.google.com/group/ppp-public.
> For more options, visit https://groups.google.com/d/optout.
>
Screenshot from 2018-06-19 17-50-30.png

cortical_iv

unread,
Jun 19, 2018, 8:49:19 PM6/19/18
to PPP-public
On Tuesday, June 19, 2018 at 6:06:41 PM UTC-4, Christiano wrote:
It is working here, as the attached image shows.

Identifying the problem:

Run the program but don't close it.
For example:
$ ./12 &
(put the & at the end of the line so that you can get the terminal control)

The result will be something like:
$ ./12 &
[1] 764
$ JPEG file "simple_image.jpg" is too large or contains errors!

Do you see the number 764? That number is the PID number of the process "./12", it may be different when you try it.
after (while the program is running), do this:
press Enter:
$ pwdx 764
(Remember, Your PID number may be different than 764)

Result:
764: /home/ch/Downloads/gui/ch12new

The pwdx will show the current working directory of the process, so you can see if it is correct.

Thanks for that trick I didn't know about that it is very cool. I am definitely in the right working directory, unfortunately (though I did have that problem previously when I was getting a different error, so learned that the hard way).

I get the expected behavior when I build using cmake, my hunch is it has to do with my FLTK build (I am using FLTK 1.4 and built it using cmake as outlined in tortured detail here: https://groups.google.com/forum/#!topic/fltkgeneral/LW7xOP4lb8g).  They dialed me into the appropriate way to build FLTK using cmake, and helped me tweak CMakeLists.txt, which is at the repository.

My hunch is there is something amiss in the Makefile in ch12new (after all, cmake just makes a Makefile, so at least *one* Makefile is working ok).

Christiano SA

unread,
Jun 20, 2018, 2:36:05 AM6/20/18
to ppp-p...@googlegroups.com
You are using cmake with fltk 1.4, which you've built in this directory: /usr/lib/fltk-1.4/build

Detail: You shouldn't have build in the /usr/lib, you could build in your home directory (~) because /usr/lib is a directory to installed libs.

But, when you use g++ command line without specify the directories, you are using the Default include path and lib path. (Probably you are using the installed fltk with apt-get (1.3.4). )

If you want to use the lib and and headers of fltk 1.4 build, you need to specify it using -I and -L.
For example, if the fltk 1.4 build has the directories:
/usr/lib/fltk-1.4/build/include
/usr/lib/fltk-1.4/build/lib

So, you need to do:

g++ -w -Wall -std=c++11 -I/usr/lib/fltk-1.4/build/include -L/usr/lib/fltk-1.4/build/lib Graph.cpp Window.cpp GUI.cpp Simple_window.cpp main.cpp -lfltk -lfltk_images -o hello_fltk

And when the executable is exectuted, it needs to search the correct shared lib, so you need to change the LD_LIBRARY_PATH too before execute it:
# export LD_LIBRARY_PATH="/usr/lib/fltk-1.4/build/lib:$LD_LIBRARY_PATH"
(:$LD_LIBRARY_PATH at end keeps the previous other paths)

All this complications happen because you've choose to use a separated build directory instead to install the libs and headers in system default positions.

You can simplify it...
Remove the packages fltk, fltk-dev, etc, which is 1.3.4 probabily, using apt-get remove
enter in the build directory, which has a Makefile because your previous command "cmake ..", and do "make install"

Doing it, you will have the same lib and headers installed in your system that you have in your build directory, and the command line compilation will be simple, and without necessity of change LD_LIBRARY_PATH environment variable, and the "cmake method", makefile, and command line will work.

> Sent: Tuesday, June 19, 2018 at 9:49 PM
> From: cortical_iv <thomso...@gmail.com>
> To: PPP-public <ppp-p...@googlegroups.com>
> Subject: Re: chcpp.info will be turned off
>
Message has been deleted

cortical_iv

unread,
Jun 20, 2018, 9:19:02 AM6/20/18
to PPP-public
On Wednesday, June 20, 2018 at 2:36:05 AM UTC-4, Christiano wrote:
You are using cmake with fltk 1.4, which you've built in this directory: /usr/lib/fltk-1.4/build

Detail: You shouldn't have build in the /usr/lib, you could build in your home directory (~) because /usr/lib is a directory to installed libs.

But, when you use g++ command line without specify the directories, you are using the Default include path and lib path. (Probably you are using the installed fltk with apt-get (1.3.4). )

If you want to use the lib and and headers of fltk 1.4 build, you need to specify it using -I and -L.
For example, if the fltk 1.4 build has the directories:
/usr/lib/fltk-1.4/build/include
/usr/lib/fltk-1.4/build/lib

So, you need to do:

g++ -w -Wall -std=c++11 -I/usr/lib/fltk-1.4/build/include -L/usr/lib/fltk-1.4/build/lib Graph.cpp Window.cpp GUI.cpp Simple_window.cpp main.cpp -lfltk -lfltk_images -o hello_fltk

And when the executable is exectuted, it needs to search the correct shared lib, so you need to change the LD_LIBRARY_PATH too before execute it:
# export LD_LIBRARY_PATH="/usr/lib/fltk-1.4/build/lib:$LD_LIBRARY_PATH"
(:$LD_LIBRARY_PATH at end keeps the previous other paths)

All this complications happen because you've choose to use a separated build directory instead to install the libs and headers in system default positions.

You can simplify it...
Remove the packages fltk, fltk-dev, etc, which is 1.3.4 probabily, using apt-get remove
enter in the build directory, which has a Makefile because your previous command "cmake ..", and do "make install"

Doing it, you will have the same lib and headers installed in your system that you have in your build directory, and the command line compilation will be simple, and without necessity of change LD_LIBRARY_PATH environment variable, and the "cmake method", makefile, and command line will work.

Very impressive sleuthing! It seems you solved what the others couldn't. :)

So basically instead of /usr/lib, I should have installed elsewhewre? Home directory, and not /usr/local/lib? As I research this, it seems the latter is often recommended. E.g.:


But maybe home is just as good?

At work so will get at this tonight after.

Christiano

unread,
Jun 20, 2018, 11:09:47 AM6/20/18
to PPP-public
ch12new version 20180620 attached.

news:
- Without warnings (it was tested with clang++ and g++)
ch12new20180620.tar.gz
Reply all
Reply to author
Forward
0 new messages