run qwt example in Qt 5 on linux ubuntu - c++

I cant figure out what I need to do for running example program which use Qwt library.
I download the file qwt-6.1.2.tar.bz2 from here as usual it goes to Download Direcory and I extract the file to this directory. I have now qwt-6.1.2 directory in Downloads directory.
The Qt directory in my machine located in /opt/Qt5.4.1/
How I continue from here?
I try to run qmake:
natile#natile-Precision-T1650:/opt/Qt5.4.1/5.4/gcc_64/bin$ sudo ./qmake /home/natile/Downloads/qwt-6.1.2/qwt.pro
And after I ran make:
natile#natile-Precision-T1650:/opt/Qt5.4.1/5.4/gcc_64/bin$ sudo make
but I get an error:
cd src/ && ( test -e Makefile || /opt/Qt5.4.1/5.4/gcc_64/bin/qmake /home/natile/Downloads/qwt-6.1.2/src/src.pro -o Makefile ) && make -f Makefile
make[1]: Entering directory `/opt/Qt5.4.1/5.4/gcc_64/bin/src'
compiling /home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_abstract_scale_draw.cpp
In file included from /home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_abstract_scale_draw.cpp:19:0:
/home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_scale_map.h:92:5: error: ‘QT_STATIC_CONST’ does not name a type
/home/natile/qtcreator-projects/qwt/qwt-5.2/src/qwt_scale_map.h:93:5: error: ‘QT_STATIC_CONST’ does not name a type
make[1]: *** [obj/qwt_abstract_scale_draw.o] Error 1
make[1]: Leaving directory `/opt/Qt5.4.1/5.4/gcc_64/bin/src'
make: *** [sub-src-make_first-ordered] Error 2
I understand that I have to run qmake.
I get nothing in the installation URL: http://qwt.sourceforge.net/qwtinstall.html
Please help.

The following approach works good for me:
cd /home/natile/Downloads/qwt-6.1.2/
mkdir build
/opt/Qt5.4.1/5.4/gcc_64/bin/qmake qwt.pro -o build/Makefile QWT_CONFIG="QwtExamples"
cd build
make
cd examples/bin
# Now you can launch any example, like:
./dials

Related

codelite unittest++/UnitTest++.h: no such file or directory

I am trying to do unit testing with C++/Codelite. I have UnitTest++ plugin installed from codelite-plugins package (Ubuntu 18.04). I can also see this:
$ ls -la /usr/include | grep Unit
drwxr-xr-x 3 root root 4096 Mar 2 11:47 UnitTest++
$ sudo dpkg -l | grep unittest++
ii libunittest++-dev 2.0.0-2 amd64 unit testing framework for c++, static library and headers
ii libunittest++2:amd64 2.0.0-2 amd64 unit testing framework for c++, runtime library
So I create a test project in Codelite and I add this:
#include <unittest++/UnitTest++.h> // This line and main are auto-created
TEST(SanityTest)
{
CHECK_EQUAL(1, 1);
}
int main(int argc, char **argv)
{
return UnitTest::RunAllTests();
}
Now I would expect test results after I press CTRL+F5. But when I do, I only get a popup window saying there are no tests:
I also noticed that when I go to Build > Build Project I get an error message:
fatal error: unittest++/UnitTest++.h: No such file or directory
I also found THIS ANSWER and tried different variation of console commands as per answer/comments there, but I always get the same no such file or directory error.
Any idea what I am missing?
EDIT:
Build log as per Stephen's Newell request:
/bin/sh -c '/usr/bin/make -j8 -e -f Makefile'
----------Building project:[ Test - Debug ]----------
make[1]: Entering directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
/usr/bin/g++ -c "/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp" -g -o Debug/main.cpp.o -I. -I/usr/include/unittest++
/home/callmebob/Documents/workspace-codelite/cpp/Test/main.cpp:1:10: fatal error: unittest++/UnitTest++.h: No such file or directory
#include "unittest++/UnitTest++.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Test.mk:95: recipe for target 'Debug/main.cpp.o' failed
make[1]: *** [Debug/main.cpp.o] Error 1
make[1]: Leaving directory '/home/callmebob/Documents/workspace-codelite/cpp/Test'
Makefile:4: recipe for target 'All' failed
make: *** [All] Error 2
====2 errors, 0 warnings====
Also if I right-click the project, go to Settings > Compiler, I can see:
Included Paths = /usr/include/unittest++
Based on your ls output, it looks like you should change your first line to this:
#include <UnitTest++/UnitTest++.h>
I'm not sure why the answer you linked to worked with a lowercase directory name; the examples in the project documentation all use the mixed-case directory name.

Install GCC: fatal error: gnu/stubs-32.h: No such file or directory

I'm using a server with Centos 6.6. I don't have root access and I want to install the gcc-4.8.1 to my own directory. I found a solution and I run the following commands:
wget http://www.netgull.com/gcc/releases/gcc-4.8.1/gcc-4.8.1.tar.gz
tar zxvf gcc-4.8.1.tar.gz
cd gcc-4.8.1
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.8.1/configure --prefix=$HOME/gcc-4.8.1 --enable-languages=c,c++,fortran,go
make
I got errors when running the make command. It reports the following information:
configure: error: `CC' has changed since the previous run:
configure: former value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/include -isystem /home/mypath/software/try_gcc2/installed/x86_64-unknown-linux-gnu/sys-include '
configure: current value: `/home/mypath/software/try_gcc2/objdir/./gcc/xgcc -B/home/mypath/software/try_gcc2/objdir/./gcc/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/bin/ -B/home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/lib/ -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/include -isystem /home/mypath/gcc-4.8.1/x86_64-unknown-linux-gnu/sys-include '
configure: error: in `/home/mypath/software/try_gcc2/objdir/x86_64-unknown-linux-gnu/libgcc':
configure: error: changes in the environment can compromise the build
configure: error: run `make distclean' and/or `rm ./config.cache' and start over
make[2]: *** [configure-stage1-target-libgcc] Error 1
make[2]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/home/mypath/software/try_gcc2/objdir'
make: *** [all] Error 2
I cannot figure what's wrong with my command. Thank you all for helping me!!!
I think I have found the solution. When I'm trying to build gcc-5.2.0, it reports that my server does not have 32-bit libraries. It also informs that if I still want to install anyway, I can add --disable-multilib when building. I tried and now the build is running normally.

gcc 4.7 on Fedora 23 with gcc 5.3.1

I need to install gcc 4.7.x on my fedora 23 in order to make Matlab compile the code. I also came across an error when I was trying to use Cuda which required gcc 4.9.x or lower.
I tried to compile gcc-4.7.4 from scratch but I get the following errors:
Makefile:4107: recipe for target 'all-stage1-gcc' failed
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/x/src/objdir'
Makefile:19334: recipe for target 'stage1-bubble' failed
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory '/home/x/src/objdir'
Makefile:903: recipe for target 'all' failed
make: *** [all] Error 2
I made a separate directory for configuration and building and I ran the configure as:
../gcc-4.7.4/configure --enable-languages=c,c++ --disable-multilib --prefix=$HOME/gcc-4.7.4
However I think the problem rises from the fact that I am using gcc-5.3.1 to compile gcc-4.7.4 but I have no idea how to fix it.
I noticed there is no packages available from dnf to install gcc-4.7.x either.
It looks like you put your build dir inside the source tree. Don't do that. Follow the wiki's instructions.
do not run ./configure from within the source directory, this is not supported. You need to run configure from outside the source directory, in a separate directory created for the build
It'll look something like this:
tar xzf gcc-4.7.4.tar.gz
cd gcc-4.7.4
./contrib/download_prerequisites
cd ..
mkdir objdir
cd objdir
$PWD/../gcc-4.7.4/configure --no-multilib --prefix=$HOME/gcc-4.7.4 --enable-languages=c,c++
make
make install
This question is a little dated now, but patching gcc/cp/cfns.gperf did the trick for me. See here: https://gist.github.com/joka90/bb8ef36aa755994d3b3d/. Built using gcc 5.3.1 under Fedora 23.
#Download and apply fix to be able to build gcc 4.7 with gcc 5.1
cd /path/to/build/gcc/source
wget https://patchwork.ozlabs.org/patch/504982/raw/ -O cfns-fix-mismatch-in-gnu_inline-attributes.patch
patch -p1 -i cfns-fix-mismatch-in-gnu_inline-attributes.patch

Building Mono from Source (not git) Fails with mcs: Command not found

Building mono from downloaded source on an Android device. Ran make get-monolite-latest and still get the following errors
make[2]: Entering directory `/bld/mono/mono-4.0.0/runtime'
if test -w /bld/mono/mono-4.0.0/mcs; then :; else chmod -R +w /bld/mono/mono-4.0.0/mcs; fi
cd /bld/mono/mono-4.0.0/mcs && make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='binary_reference_assemblies net_4_5 xbuild_12 xbuild_14 monodroid ' CC='gcc --sysroot=/usr/gcc-4.9.2/sysroot' all-profiles
make[6]: mcs: Command not found
make[6]: *** [build/deps/basic-profile-check.exe] Error 127
*** The compiler 'mcs' doesn't appear to be usable.
*** Trying the 'monolite' directory.
Illegal instruction
make[8]: *** [build/deps/basic-profile-check.exe] Error 132
*** The contents of your 'monolite' directory may be out-of-date
*** You may want to try 'make get-monolite-latest'
I've found what I think is the mcs executable in runtime/_tmpdir/bin, but copying it to where the build seems to be looking for it doesn't help.
How do I resolve this?
As the error message suggests: You may want to try the command 'make get-monolite-latest'
You need a certain mono version for building mono 4, I think it was >= 3.8 or so. The monolite should help out in this case.

gcc 4.5 installation problem under ubuntu

I tried to install gcc 4.5 on ubuntu 10.04 but failed.
Here is a compile error that I don't know how to solve. Is there anyone successfully install the latest gcc on ubuntu?
Following is my steps and the error message, I'd like to know where is the problem....
Step1: download these files:
gcc-core-4.5.0.tar.gz
gcc-g++-4.5.0.tar.gz
gmp-4.3.2.tar.bz2
mpc-0.8.1.tar.gz
mpfr-2.4.2.tar.gz
Step2: Unzip above files
Step3: move gmp, mpc, mpfr to the gcc-4.5.0/ directory.
mv gmp-4.3.2 gcc-4.5.0/gmp
mv mpc-0.8.1 gcc-4.5.0/mpc
mv mpfr-2.4.2 gcc-4.5.0/mpfr
Step4: go to gcc-4.5.0 directory and do configuration:
sudo ./configure
Step5: compile and install
sudo make
sudo make install
The first 4 steps is OK, I can configure it successfully. However, when I try to compile it, following error message comes out, I cannot figure out what the problem is. Should I change the name from "gcc 4.5" to "gcc"?? It's a little strange that we need to do this by ourself. Is there anything I missed during the installation?
xxx#xxx-laptop:/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0$ sudo make
[sudo] password for xxx:
[ -f stage_final ] || echo stage3 > stage_final
/bin/bash: line 2: test: /media/Data/Tool/linux/gcc: binary operator expected
/bin/bash: /media/Data/Tool/linux/gcc: No such file or directory
make[1]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[3]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
rm -f stage_current
make[3]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[2]: Entering directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
Configuring stage 1 in host-x86_64-unknown-linux-gnu/intl
/bin/bash: /media/Data/Tool/linux/gcc: No such file or directory
make[2]: *** [configure-stage1-intl] Error 127
make[2]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/media/Data/Tool/linux/gcc 4.5/gcc-4.5.0'
make: *** [all] Error 2
It might not be a good idea to have a space in your path - it's kind of rare and can easily mess up shell scripts that aren't specially designed to deal with it (which is a bad combination!)
Another potential problem is that you're running configure inside the gcc source directory - this isn't recommended (and didn't work at all for me on at least one version of gcc 4). Instead make an empty build directory, parallel to the source directory, so you have something like:
gcc 4.5 <- but might want to avoid the space
gcc-4.5.0
...
build
Then cd into build and run
../gcc-4.5.0/configure
You may also need to start from a freshly unzipped source directory, as the previous failed build may have broken it.