Using Boost.Json lib in Visual Studio 2013 - c++

I have been trying to use new Boost.Json lib that was launched in the latest version of boost 1.75.0. For testing purposes I created an empty VS project and added one file and tried to build it. I added the directory in the project's additional include directory. This is what my source file looks like:
#include <boost\json.hpp>
void main(){
return;
}
When I compile this I get following error:
Error 8 error C1903: unable to recover from previous error(s); stopping compilation
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 311 1 Project1
Error 5 error C2065: 'T' : undeclared identifier
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 311 1 Project1
Error 7 error C2143: syntax error : missing ';' before
'boost::json::detail::static_const<T>::value'
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 311 1 Project1
Error 2 error C2146: syntax error : missing ';' before identifier 'T'
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 308 1 Project1
Error 4 error C2146: syntax error : missing ';' before identifier 'T'
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 311 1 Project1
Error 6 error C2923: 'boost::json::detail::static_const' : 'T' is not a valid template type
argument for parameter 'T' C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 311 1 Project1
Error 1 error C3646: 'noexcept' : unknown override specifier
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 292 1 Project1
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Libraries\boost_1_75_0\boost\json\detail\config.hpp 308 1 Project1
Just to verify if I included the boost lib right, I wrote another code
#include <boost\property_tree\json_parser.hpp>
void main(){
return;
}
and it compiled fine. The reason I want to use json lib instead of property trees is because I want to retain the data type of the json objects whereas trees parse everything in string. Any help will be really appreciated. Thank you.

Boost.JSON is not tested to compile with Visual Studio 2013. I doubt that it could ever work, as that version of the IDE and compiler does not support C++11 sufficiently for the library.

Related

Having issues with linking to boost library (C++ in Visual Studio 2013)

I have been banging my head on this for a few days now. I tried downloading and compiling the latest boost 1.67.0, to include
#include <boost/iostreams/device/file_descriptor.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/process.hpp>
But I got the errors seen below when trying to compile (one thing I noticed about it is that the path has slashes going the wrong way in the error log and Im not sure how to fix that?
I tried compiling with standard cmd and also Visual Studio 2013 prompt (same result).
I then tried grabbing the precompiled version from boost site
boost_1_67_0-msvc-12.0-32.exe
And am still getting the same problem. The #include text is not underlined in the editor. And I have additional include directories pointing to:
C:\VisualStudioLibraries\boost_1_67_0
and Linker Additional Library Directories to
C:\VisualStudioLibraries\boost_1_67_0\stage\lib
Does anyone know how to resolve this? If I comment out the #include lines for boost the code compiles without any issues and program runs. My code doesnt use anything from boost yet, so the only boost related stuff in there are the 3 #include lines.
Errors are:
1> MyForm.cpp
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(65): error C3646: 'noexcept' : unknown override specifier
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(72): error C2660: 'boost::process::process_error::process_error' : function does not take 2 arguments
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(77): error C2660: 'boost::process::process_error::process_error' : function does not take 2 arguments
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(82): error C2440: '' : cannot convert from 'std::error_code' to 'boost::process::process_error'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(88): error C2440: '' : cannot convert from 'const std::error_code' to 'boost::process::process_error'
1> No constructor could take the source type, or constructor overload resolution was ambiguous
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(94): error C2660: 'boost::process::process_error::process_error' : function does not take 2 arguments
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97): error C2146: syntax error : missing ';' before identifier 'Char'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97): error C2146: syntax error : missing ';' before identifier 'null_char'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(97): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(98): error C2144: syntax error : 'char' should be preceded by ';'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(98): error C2143: syntax error : missing ';' before '<'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(99): error C2143: syntax error : missing ';' before '{'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(99): error C2447: '{' : missing function header (old-style formal list?)
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101): error C2146: syntax error : missing ';' before identifier 'Char'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101): error C2146: syntax error : missing ';' before identifier 'equal_sign'
1>C:\VisualStudioLibraries\boost_1_67_0\boost/process/detail/config.hpp(101): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Thank you all very much.
Well, Im sure this is not the answer most will want to hear, but after trying for over a week to get it to work the only thing that ended up working was to move on to Visual Studio 2017. Everything linked and compiled fine there. Perhaps there is an issue with my VS2013 install (but everything else works flawlessly on it).

Tesseract 3.05 Build errors in Visual Studio 2017

I used the solution provided here in order to make Tesseract 3.05 work on my windows10 x64 project, visual studio 2017.
I got these errors when building it:
11>c:\users\mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unichar.h(164): error C3646: 'UTF32ToUTF8': unknown override specifier
11>c:\users\mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unichar.h(164): error C2059: syntax error: 'const'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unichar.h(164): error C2238: unexpected token(s) preceding ';'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\genericvector.h(376): warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\params.h(205): warning C4800: 'BOOL8': forcing value to bool 'true' or 'false' (performance warning)
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(241): error C3646: 'CleanupString': unknown override specifier
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(241): error C2059: syntax error: 'const'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(241): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(244): error C3646: 'CleanupString': unknown override specifier
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(244): error C2059: syntax error: 'const'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(244): error C2238: unexpected token(s) preceding ';'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(265): error C2065: 'string': undeclared identifier
11>c:\users\mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(265): error C2146: syntax error: missing ';' before identifier 'cleaned'
11>c:\users\ mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(265): error C2065: 'cleaned': undeclared identifier
11>c:\users\mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(265): error C3861: 'CleanupString': identifier not found
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\unicharset.h(266): error C2065: 'cleaned': undeclared identifier
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(181): error C3646: 'VersionString': unknown override specifier
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(181): error C2059: syntax error: '('
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(181): error C2238: unexpected token(s) preceding ';'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(183): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(183): error C2143: syntax error: missing ',' before '&'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(134): error C2664: 'void tesseract::TessdataManager::SetVersionString(const int)': cannot convert argument 1 from 'const char [13]' to 'const int'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(134): note: There is no context in which this conversion is possible
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(138): error C2664: 'void tesseract::TessdataManager::SetVersionString(const int)': cannot convert argument 1 from 'const char [13]' to 'const int'
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\ccutil\tessdatamanager.h(138): note: There is no context in which this conversion is possible
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\dict\dict.h(55): warning C4566: character represented by universal-character-name '\u2606' cannot be represented in the current code page (1252)
11>c:\users\jihed mestiri\documents\vs2015_tesseract-master\vs2015_tesseract-master\tesseract_3.05\api\tesseractmain.cpp(34): fatal error C1083: Cannot open include file: 'simddetect.h': No such file or directory
11>Done building project "tesseract.vcxproj" -- FAILED.
========== Build: 9 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========
How to resolve them?
Since the time of the linked answer, project structure was changed. It's updated to Tesseract 3.05 and clear Git submodule links to the proper Leptonica and tesseract_3.05 sources added.
It looks like you've downloaded master sources for both of them. At the moment VS2015_Tesseract is not compatible with it.
Proper dependency links are: leptonica # e98a794 and tesseract_3.05 # 7fe95f0. Download it and try to rebuild the solution.
After adding in C/C++ -> Additional Include libraries:
C:\Users\Jihed Mestiri\Documents\VS2015_Tesseract-master\liblept
C:\Documents\VS2015_Tesseract-master\leptonica\src
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\wordrec
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\opencl
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\viewer
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\textord
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\neural_networks\runtime
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\dict
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\cutil
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\cube
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\classify
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\ccstruct
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\ccutil
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\ccmain
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\api
C:\Users\Documents\VS2015_Tesseract-master\tesseract_3.05\vs2010\port
as well as the directory that contains .lib files in Linker -> General -> Additional Library directories and included in Linker -> Input -> Additional dependencies these .lib files of Tesseract and Leptonica:
libtesseract.lib
giflib.lib
libjpeg.lib
liblept.lib
libpng.l‌​ib
libtiff.lib
li‌​bwe‌​bp.lib
openjpeg.lib
‌​zlib.lib
Compilation errors of my test program changed to:
1>------ Build started: Project: RedEyeRemover, Configuration: Debug x64 ------
1>LINK : fatal error LNK1104: cannot open file 'libpng.l‌​ib'
1>Done building project "RedEyeRemover.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Whereas the directory that contains libpng.lib file is included in Linker->General.
The parameters are taken from tesseract/tesseract.vcxproj that I build from VS2015_Tesseract
What can be the reason behind that error? and is there a way to verify that tesseract.vcxproj is working correctly at its own? because I get errors when I compile it too on Visual Studio 2017 (using v140 = VS 2015 version for build) on x64 target.
EDIT: SOLUTION: I discovered that the problem was in Linker -> General -> Additional Library directories where I had a space in one of the parent directory of the path e.g: "xxx xxx/tesseract". => avoid using paths with space.

Visual Studio 2005 throws build error in soapclient.cpp I built with GSoap

I have built soapclient.cpp using GSoap libraries all built successfully, without any errors. Now included the necessary files to the project as instructed by the guide (http://www.genivia.com/dev.html#Example_gSOAP_client_(C++)), but getting following errors, included some here. has anyone come across it, any ideas?
i am using gSoap release 2.8.27
Includes:
soapH.h
soapStub.h
soapSubscribeNetBindingProxy.h
stdsoap2.h
SubscribeNetBinding.nsmap
soapC.cpp, soapClient.cpp, and stdsoap2.cpp
Errors---
Error 1 error C2079: 'soap_tmp_ns__echoString' uses undefined struct 'soap_call_ns__echoString::ns__echoString' c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 23
Error 2 error C2228: left of '.inputString' must have class/struct/union c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 27
Error 3 error C3861: 'soap_serialize_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 29
Error 4 error C3861: 'soap_put_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 36
Error 5 error C3861: 'soap_put_ns__echoString': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 47
Error 6 error C3861: 'soap_get_ns__echoStringResponse': identifier not found c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 60
Error 7 error C2027: use of undefined type 'soap_call_ns__echoString::ns__echoStringResponse' c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 67
Error 8 error C2227: left of '->_return' must point to class/struct/union/generic type c:\dev\riedel\riedellicencemanager\riedellicencemanager\subscribenetproxy\soapclient.cpp 67 }
Do the following.
Remove any references to stdafx.h, from the project
Remove soapClient.cpp
Make sure each cpp file included is to 'Not using pre-compiled headers'
Include dom.h
Include dom.cpp
Project should compile now. if need further help start from calc_vs2005 project included in the gSoap.

Can't include DirectShow sample and compile it (PushSourceDesktop)

So I'm trying to compile the PushSourceDesktop sample with my other project so I can use the 'new' keyword to make an object directly without loading an external dll. I've included all the files in my project and added my precompiled header to the .cpp files. I'm down to these errors that I can't really figure out even with the help of google and various other searches. Hoping someone here might be able to shed some light, thanks in advance!
Error 4 error C2065: 'm_pString' : undeclared identifier c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 292 1 record3
Error 5 error C2065: 'm_pString' : undeclared identifier c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 316 1 record3
Error 1 error C2146: syntax error : missing ';' before identifier 'm_pString' c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 295 1 record3
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 295 1 record3
Error 3 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 295 1 record3
8 IntelliSense: identifier "PTCHAR" is undefined c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\directshow\baseclasses\wxdebug.h 295 5
The problem is related to order of inclusion of SDK headers. You perhaps need to add #include <tchar.h> somewhere on top of the code since PTCHAR is that compiler is unable to find.
Because DirectShow Base Classes is quite specific class base, I would suggest that you don't mix it with other C++ code you are having (such as ATL, WTL or MFC). This is possible , but this is likely to keep causing issues similar to the one in your question.
Instead, you can keep your filter in separate DLL, you can instantiate it via CoCreateInstance or privately through DllGetClassObject/CreateInstance, and communicate to it over private interface.

compilation problems using boost math

I used to installer from http://www.boostpro.com/download/ to build boost and would like to use some of the math functions. Something like this:
Plm[l][m] = boost::math::legendre_p(l,m,cosine);
Naturally, I included:
#include <boost/math/special_functions/spherical_harmonic.hpp>
And added the path to boost to my additional (boost\boost) include directories and the path to the lib (boost\lib) to the additional linker directories (VS2008). I'm getting some compilation errors I can't seem to figure out the cause:
Error 6 error C2955: 'boost::mpl::if_' : use of class template requires template argument list D:\work\multipoles\Project\boost\boost\math\policies\policy.hpp 724
Error 2 error C2825: 'Policy': must be a class or namespace when followed by '::' D:\work\multipoles\Project\boost\boost\math\policies\policy.hpp 724
Error 4 error C2146: syntax error : missing ',' before identifier 'promote_double_type' D:\work\multipoles\Project\boost\boost\math\policies\policy.hpp 724
Error 5 error C2065: 'promote_double_type' : undeclared identifier D:\work\multipoles\Project\boost\boost\math\policies\policy.hpp 724
Error 3 error C2039: 'promote_double_type' : is not a member of '`global namespace'' D:\work\multipoles\Project\boost\boost\math\policies\policy.hpp 724
Any pointers would be much appreciated!
Alright, this was though one. In my code, l and m are unsigned. But there is only an overload for legendre_p(int,int,T). Thus, my function call is mapped to legendre_p(int,T,&policy) (or so I think).