Using cpp-netlib in a C++ project under Windows - c++

I want to use the cpp-netlib library in a C++ project of mine running on Windows.
I've strictly followed the instructions under http://cpp-netlib.github.com/getting_started.html up to the "Getting CMake" section, which is where
I stopped understanding the instruction. Is CMake indeed non-obligatory? If so, what are the exact steps required so I can use the library in my projects?
If someone could provide me with instructions here, or refer me to a detailed guide it'd be
great. Google didn't help me that much.

Same problem here:
I got it going with
From the directory I dumped cpp-netlib-0.9.4 in
cd ..
mkdir cpp-netlib-build
cd cpp-netlib-build
cmake.exe -G "Visual Studio 10" -DBOOST_ROOT:string="C:\Dev\Boost\boost_1_51_0" ../cpp-netlib-0.9.4
(Your paths may vary)
This populates the cpp-netlib-build directory with a VS10 solution and projects.

Related

Cannot Run Compiler 'cl' for qt5.10.1 on Windows 10 in terminal

I have never used qt before, but I got a task to build an already existing application for Windows and Mac using the newest version of qt. What I have done so far is:
Installed Visual Studio Professional 2017.
Installed the latest Qt 5 Open Source.
Note: when installing the QT 5 I installed all of the components under QT/ QT 5.10.1 which were: qt 5.10.1 components and under QT/Tools I installed QT Creator 4.6.0 CDB Debugger Support and MinGW 5.3.0 : qt 5 Tools
I cloned the branch from GitHub that I wanted to build to C:/Projects
Then in Git Bash I cd to the project and tried to run qmake. The first time I had this problem:
"bash: qmake: command not found"
After searching into the problem I found out that I haven't added "Qt/5.10.1/msvc2017_64/bin" to PATH and I added it. Now when I echo $PATH I can see the directory added.
Now after bash recognises qmake and I try to run it it says:
Project ERROR: Cannot run target compiler 'cl'. Output:
===================
Maybe you forgot to setup the environment?
I have no idea how to fix the problem due to the fact that I have never used QT to build anything before. Can you help me?
In the read me file for the application I am trying to build it says:
Step-by-step instructions
1. Clone this branch
2. cd into the project
3. Run qmake - this wil generate Makefiles for all of the project's modules
4.Run make (Use the -j4 of -j flags - this greatly speeds up the build process - see the manual page for make for more info). You can also use the -s flag to silence the output - this also wins you a few seconds.
I am a bit puzzled by the instructions, it does not say to run qmake -project anywhere, but there is a qt project file in the directory that I cd to. Does this mean that I don't have to run qmake -project?
Also I have no idea how to run make by using the -j4 and -j flags and how to run flags in general. Could someone help me?
I believe that for the Cannot Run Compiler 'cl' issue I have some kind of a problem with the set up. Did I install too many components or is it to do with the VS setup?
I highly recommend you to install Qt from the Qt installer, and to use Qt Creator.
However, if you want to use it from source, you first need to get a compiler (ex: MinGW). Then you need to execute the instructions, but you need to use a MinGW (or whatever compiler you use) command prompt, which will automatically set the environment variables needed.
Note that this is Windows specific. On mac and linux, the compiler's environment variables are already set in the default command prompt (if there is a compiler, obviously).

What is different of wxWidgets between when install by MSYS and compile by MinGW?

I am learning GUI programing on Windows, and I choose wxWidgets, Eclipse, MinGW for my learning. I can compile wxWidgets with command:
mingw32-make SHELL=CMD.exe -j4 -f makefile.gcc BUILD=release UNICODE=1
And I found that I can install it by MSYS by command
cd /mingw/wxWidgets-2.8.10
./configure –prefix=/mingw –disable-shared
make && make install
What must I do to integrate wxWidgets with Eclipse? Do I compile it by MinGW or install it by MSYS and How can I set up it for Eclipse Neon?
`
From your standpoint there is no difference.
It is better to compile the library with MinGW and do a DEBUG build since you will do development and a lot of times this will help a lot.
Now in order to set it up with Eclipse:
After you build is finished, open up Eclipse.
Create a project (C++) or open an existing one.
Open the dialog for project properties and find where it asks you to set the "include/header search path".
Set this to be "/include;/lib/debug/include". The second path is a path to the build_directory/include where setup.h is located.
In the same dialog for project properties find where it asks for a library search path.
There enter "main_wx_folder/lib".
Somewhere in that same page of this dialog find where it referencing the actual libraries. Add "-lwx_base... -lwx_core...". Check the actual file names inside the lib/ folder. Should be something like libwx_*.
Compile the project.
Keep in mind though that Eclipse is not "officially supported" IDE, meaning that there is no project for that IDE supplied with the library and there is not too many people use it for C++ development with wx.
The "official supported IDE" for wx are: MSVC, CodeBlocks and (to some extent) CodeLite.
It use to support Borland compiler (and IDE), but unfortunately there was a recent posts on the forum that recent version of Embarcadero broke the build of the library. This compiler is still supported though.
Good luck! If you have any issues don't hesitate to update the question with any possible errors.

Cannot open include file 'getopt.h'

Firstly, I know nothing about C/C++, but I am trying to compile LCI https://github.com/justinmeza/lci under Windows 10 with Visual Studio 2015, but I'm getting the following error:
Cannot open include file: 'getopt.h': No such file or directory.
I see that getopt is not part of Visual C so people are saying you have to implement your own. It looks like this is what I need:
https://github.com/skandhurkat/Getopt-for-Visual-Studio/blob/master/getopt.h
Problem is, I don't really know what to do with this file. I've been reading a fair bit and messing around for ages just to compile lci.exe!
Already emailed the OP about this, but here's the steps I followed in order to build lci successfully. The missing step seemed to be that Justin Meza neglected to mention that you need to install CMake as well in order for the install script to work. CMake will allow you to build C code against the glibc headers.
Install MinGW
Install Python 3.5.1 (or latest Windows version)
Install Git for Windows (if you haven't already)
Make sure to enable Git for the Windows command prompt
Install CMake
Add MinGW and Python to your PATH environment variable. I'd double check that your paths to the executables are correct, mine looked like this:
C:\Program Files\mingw-w64\mingw64\bin
C:\Users{username}\AppData\Local\Programs\Python\Python35-32
Run a command prompt as administrator, and go to your Documents folder and clone the lci repository (if you haven't already):
git clone https://github.com/justinmeza/lci.git
Go into the lci directory, and run:
install.py --prefix="C:/Program Files/lci"
Add lci to you PATH, if using the default location add this to the end of your PATH:
C:\Program Files\lci\bin
I would have included some links to the various programs above in steps 1-4 but apparently I don't have enough reputation on StackOverflow for that...you should be able to find them easily enough in a quick Google search.
You should now be able to run lci from any command prompt. A good test would be to run the "HAI WORLD" code at lolcode.org.
Just copy getopt.h to the directory where .c files are, so the compiler can find it.
Based on the linked source code and it's contents, the project you're trying to build appears to be written for Linux. It might be possible to sufficiently rewrite it to be able to compile under Microsoft Windows, and Microsoft's compiler; or perhaps install something like MinGW.
However, given your stated lack of development experience, this does not appear to be something that you could easily handle on your own.

instructions on building CGAL libraries from source code

I have installed Computational Geometry Algorithms Library 4.3 and followed instructions on CGAL4.3 manual page(http://doc.cgal.org/latest/Manual/installation.html).
After I cmaked CGAL-4.3 folder , it says ,"make # build the CGAL libraries".However I cant find any cmake command or .exe file to execute "make".What am I missing here?
below I copied the instructions on the manual page in case anyone cant access it.
1 Introduction
This document describes how to install CGAL on Windows, Unix-like systems, and MacOS X.
Ideally, setting up CGAL amounts to:
cd CGAL-x.y # go to CGAL directory
cmake . # configure CGAL
make # build the CGAL libraries
You are on windows so you may not have make.
You can either install make or tell Cmake to generate something else than a makefile (like a Visual Studio project for instance).
If you are using Cygwin, it should be pretty easy to install make or maybe you already have it. Try typing make at the Cygwin prompt.
From my limited experience building code on windows, I recommend installing MinGW and Code::Blocks. Then ask Cmake to generate a Code::Blocks project using MinGW. Open the project and build it. Clean and easy.
Note that the CGAL Project provides Installation Instructions for Windows

using CMake to build Google Test

I am trying to use CMake to build Google Test.
As mentioned in the README of Google Test,
I have issued following commands:
mkdir mybuild # Create a directory to hold the build output.
cd mybuild
cmake D:\gtest-1.6.0 # (in the README this was set as:cmake ${GTEST_DIR}, but since on my machine D:\gtest-1.6.0 is where I have downloaded gtest, I have used that in command prompt.
And here is the error I get:
Any help? any help would be greatly appreciated as I am stuck with it and can't move forward...... Thanks.
ps. I have Visual Studio 10 installed on my machine.
If you use Visual c++ compiler with cmake you must launch it from the Visual c++ command prompt. Otherwise cmake will not found your compiler.