how to install FLTK for VS CODE I have configured vs code for c++ and I want to use vs code for FLTK also, there is no good guideline for the process and I did not manage to install it according to FLTK help documents, I do ./configure make, and after make install but I cannot run the code. I will list down what I did here:
download and unzip file on c:/dev/flsk/
I had mysys2 but when I tried to run the command like ./configure to configure FLTK it gave me some errors, so i downloaded MingGW with dev toolkit and after run MinGW shell.
run commands: ./configure, make, make install
that was all, now I want to compile my c++ code but it cannot access FLSK Libraries what can I doo? I want to run the code from the book of Bjarne Stroustrup name Programming - Principles and Practice Using C++ chapter 12
thank you;
#include "Simple_window.h"
#include "Graph.h"
int main()
{
using namespace Graph_lib;
Point tl {100,100};
Simple_window win {tl,600,400,"Canvas"};
Polygon poly;
poly.add(Point{300,200});
poly.add(Point{350,100});
poly.add(Point{400,200});
poly.set_color(Color::red);
win.attach (poly);
}
Related
I'm trying to learn how to use KDevelop on my Ubuntu 16.04 to write C++ code, and I installed it by doing this
sudo apt-get update
sudo apt-get install kdevelop
but after it is done installing and I'm trying to make a new project, and the lines at the top that says
#include <QtGui/QApplication>
and
#include <QtGui/QLabel>
#include <QtGui/QMenu>
#include <QtGui/QMenuBar>
#include <QtGui/QAction>
are all returning errors saying that the included files are not found? And ask me to add a custom include path. I checked my KDevelop version on the terminal and it says I have Qt, or at least I think that's what it meant.
~$ kdevelop --version
Qt: 4.8.7
KDE Development Platform: 4.14.16
KDevelop: 4.7.3
But then when I run
~$dpkg --list libqt4-dev
~$dpkg --list libqt4-core
~$dpkg --list libqt4-gui
and it says none of them are installed. I'm so confused. Do I have the right Qt or not? How do I get KDevelop to find the correct Qt path? Should I maybe just install all the libqt4-whatever and try again?
Remember to distinguish between libraries that allow you to run a software and developer versions that allow to build new sotfware. Output of kdevelop --version states versions of the libraries which are used to run the application. In your system you are missing qttools5-dev with its dependencies.
By the way, maybe you will try qtCreator? It is an IDE developed by Qt team, and if you install it just by apt install qtcreator than you will have all necessary dev libs.
The objective is to compile a C++ program with Boost.Python in Eclipse on the OS on Linux Mint 18. In particularly, we want to run the template program:
#include<boost/version.hpp>
#include<boost/python.hpp>
#include<iostream>
using namespace std;
int main() {
cout << "My first boost program with version: " << BOOST_LIB_VERSION << endl;
return 0;
}
This personally took me quite a while to get working, so the tutorial below should serve as a one-stop-shop reference for anyone in a similar situation. Note on software used:
Boost version: 1.62.0
Python version: 2.7.12
OS: Linux Mint 18 Xfce 64-bit
Eclipse version: CDT 9.1.0 for Eclipse Neon.1
Installing Eclipse CDT
Make sure that you have Java installed. For the Java JDK (if you want to also develop Java programs), run:
sudo apt-get install default-jdk
To simply run Java programs (such as Eclipse), you can install the lighter Java JRE:
sudo apt-get install default-jre
Both JDK and JRE will work, but JDK takes up more space.
Go to CDT download webpage and download the Linux 64-bit file eclipse-cpp-neon-1-linux-gtk-x86_64.tar.gz
Assuming you downloaded the file in ~/Downloads/, run the following command to unpack ("install") Eclipse into the /opt/ directory:
sudo tar zxvf ~/Downloads/eclipse-cpp-neon-1-linux-gtk-x86_64.tar.gz -C /opt/
To create a desktop launcher icon, run
sudo gedit ~/.local/share/applications/eclipse.desktop
and in the text editor copy-paste:
[Desktop Entry]
Name=Eclipse
Type=Application
Exec=/opt/eclipse/eclipse
Terminal=false
Icon=/opt/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
You now have Eclipse installed, but you don't need to run it yet, just keep reading and following the instructions :)
Installing Boost
The instructions are more or less given here, but for the sake of cohesion I write them here.
Download boost_1_62_0.tar.gz
Assuming you downloaded the file into ~/Downloads/, run the following command to unpack Boost into the /usr/include/ directory:
sudo tar zxvf ~/Downloads/boost_1_62_0.tar.gz -C /usr/include/
It's as easy as that - you now have Boost... but that's not all yet. Read on :)
Building Boost.Python and Boost.System
The Boost libraries Boost.Python and Boost.System must be built before they can be used. Here's how you do this:
Go into the Boost directory in your Terminal:
cd /usr/include/boost_1_62_0/
Run the command:
sudo ./bootstrap.sh --prefix=/usr/local
To build Boost.Python and Boost.System into the /usr/local/lib folder, run:
sudo ./b2 install --with-system --with-python
once the command has finished, you will find libboost_system and libboost_python (with various file endings) in /usr/local/lib
That's it for building the necessary Boost libraries. Note that any other Boost library that needs to be built can be done in the same way.
Preparing Python 2.7
Linux Mint 18 comes with Python 2.7 pre-installed. For me, running the command python --version returns the output Python 2.7.12. I'll assume this is the same for you - but probably it doesn't make a difference what the version is. However, to get our objective of the C++ program with Boost.Python to build and run, you have to execute the additional command:
sudo apt-get install python-dev
which places some additional necessary files (particularly pyconfig.h) into /usr/include/python2.7.
Installing Linux GCC
Linux GCC allows you to compile C++ programs. To install everything necessary, simply run:
sudo apt-get install build-essential
Making our program run in Eclipse
Now we've got everything configured to be able to write, build and run our program in Eclipse. So, let's do it!
Run Eclipse, either from the terminal (either by using the desktop icon we've created or by running /opt/eclipse/eclipse in the Terminal).
If it's your first time running Eclipse, you'll be prompted to choose a workspace (basically, a folder where all Eclipse project files will be stored):
Now go to File -> New -> C++ Project and enter the following and click Finish (you can use whatever Location you wish, including the default location (i.e. the one of your workspace)):
Now go to File -> New -> Source File, enter the following and click Finish:
In the main.cpp file that automatically opens in the editor, type in the program that we want to compile (note that I customized my Eclipse layout, so it looks different from the default layout you might have):
Now the secret sauce. Go to Project -> Properties -> C/C++ Build -> Settings where you will see:
Go to GCC C++ Compiler -> Includes and, using the little icon that looks like a folder with a green plus sign, add the following Include paths:
Go to GCC C++ Linker -> Libraries and add the following Libraries and Library search paths:
Press OK to close the Project Properties window.
Back in the main Eclipse window, first click the hammer icon to build the project, then the green play icon to run it (both buttons are highlighted in the below screenshot). In the console view you will first see a successful build, then the Terminal output of our program:
That's it! We've achieved our objective of building and running a C++ program with the Boost.Python library included. That's the end of this tutorial, I hope it helped you :)
I hope someone can help me. I have a c++ file which use opencv libraries.
I need to get an executable for an ARM in which I have to run it. My executable should be compile in a static linker way.
I am not an exepert so sorry If I am doing something weird, I follow this steps:
I download the opencv for ARM libraries, I build it with the cmake and I got the statics opencv ARM libraries without problems.
Then I try to compile my c++ file like this:
arm-linux-g++ -static -o exampleWindows IPCamera.cpp `pkg-config --cflags --libs opencv`
And it works, so I got an executable, I write:
file executable
And I get this output:
ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.26, not stripped
So it seems that is ok, is an ARM format and is a static linked. But when I try to run this executable in my ARM is comming this error:
OpenCV Error: Unspecified error (The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support.
If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config,
then re-run cmake or configure script) in cvNamedWindow,
file /home/jesus/opencv/opencv/modules/highgui/src/window.cpp, line 483
terminate called after throwing an instance of 'cv::Exception'
what(): /home/jesus/opencv/opencv/modules/highgui/src/window.cpp:483: error: (-2) The function is not implemented.
Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config,
then re-run cmake or configure script in function cvNamedWindow
Then how I am not an expert I tried to follow what the error message says, so I donwload the libgtk2.0 in my ubuntu, and then I make again the cmake and make for build the ARM static libraries, but nothing is solved.
So I need some help with this error, or tell what is the meaning, because it seem that is simple but I do not know what to do.
Here is my code:
#include <iostream>
#include <pthread.h>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv/highgui.h>
#include <string.h>
#include <stdio.h>
#include <time.h>
using namespace std;
using namespace cv;
int main()
{
cout<<"ready"<<endl;
cv::Mat frame;
cv::namedWindow("front", CV_WINDOW_NORMAL);
cvMoveWindow("front", 0, 0);
cvSetWindowProperty( "front", CV_WND_PROP_FULLSCREEN, CV_WINDOW_FULLSCREEN);
return 0;
}
Thank you so much I hope someon could help me.
The problem is that you need to rebuild OpenCV with the GTK-support activated. The necessary steps are:
Install gtk (sudo apt-get install libgtk2.0-dev, I think you did this already ;) ).
Rebuild OpenCV:
If you installed it from the repositories, re-install it (I think this is not the case).
If you manually built OpenCV from source code: run cmake with it again, making sure that the option WITH_GTK is marked (you can use the CMAKE GUI to activate that option).
Once the Makefiles have been re-generated with CMAKE, run make, make install and don't forget ldconfig.
Try again with your code ;)
Hope that it helps!
The problem is due to the fact that, you did not enable the GTK+ library support .
To enable it
1)install the GTK+ Libraries, if you don't have them
2) re build the libraries with including this -DWITH_GTK=ON
hope that this will work...
run ccmake . and enable WITH_GTK and WITH_GTK_2_X
run make && make install
ldconfig
Is there anyone who can give me an tutorial on how to install FLTK on Xcode 5. All my attempts have been without any luck. We have to use the program at my school.
I've been trying to load the frameworks in Xcode but when I am write:
#include <FL/Fl.H>
or
#include "FL/Fl.H"
It does not find the header file.
Mads
I am coding a computer vision program, which is using OpenCV 2.4, by Xcode 4.4. I want to compile and make it in the Terminal by g++ or make command. But the system shows a lot of errors that the compiler cannot find the "opencv2/opencv.hpp" file and Vec3d, etc..!
My question is how to configure the system the I can make and build the code in Terminal? Thanks.
First, you need to have command line tools (I guess you already have it)
Bring up Preference in Xcode
Select "Downloads" tab
Select "Components' tab
Click 'install' on the command line tools line.
Then, you need to install OpenCV. I suggest to use Homebrew
setup homebrew, then
brew install opencv
It will install library in /usr/local, which is in g++'s standard lookup path, thus should be ok.
If you still need help, post the log file.