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

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).

Related

I'm trying to add an external library to a Source mod, and I'm having some trouble

I'm trying to add this Serial Communications library to the Source SDK code to try to integrate my own serial input into Steam games. I've got the example projects on the Serial library I downloaded working fine. I added the Serial project to the Source solution and gave the "Server (HL2)" project a dependency to it (I'm using Visual Studio 2013 Express). I then went to my .cpp file under the Server (HL2) project and simply added
#include "Serial.h"
#define STRICT
#include <tchar.h>
#include <stdio.h>
#include <string.h>
which are the headers defined in the example project that was working for me, and got a lot of errors when I went to compile. The errors are all along the lines of:
\serial.h(190): error C2065: 'CE_RXOVER' : undeclared identifier
\serial.h(191): error C2065: 'CE_RXPARITY' : undeclared identifier
\serial.h(193): error C2065: 'CE_TXFULL' : undeclared identifier
\serial.h(215): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): error C2146: syntax error : missing ';' before identifier 'Open'
\serial.h(220): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(220): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(220): error C2061: syntax error : identifier 'LPCTSTR'
\serial.h(220): warning C4183: 'Open': missing return type; assumed to be a member function returning 'int'
\serial.h(223): error C2146: syntax error : missing ';' before identifier 'Close'
\serial.h(223): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(223): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(223): warning C4183: 'Close': missing return type; assumed to be a member function returning 'int'
\serial.h(241): error C2146: syntax error : missing ';' before identifier 'Setup'
\serial.h(241): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
\serial.h(241): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
\serial.h(244): warning C4183: 'Setup': missing return type; assumed to be a member function returning 'int'
\serial.h(250): error C2146: syntax error : missing ';' before identifier 'SetEventChar'
\serial.h(250): error C2433: 'CSerial::LONG' : 'virtual' not permitted on data declarations
They repeat and then...
\serial.h(361): error C2061: syntax error : identifier 'LPOVERLAPPED'
\serial.h(329): error C2065: 'm_lLastError' : undeclared identifier
\serial.h(345): error C2065: 'DCBlength' : undeclared identifier
\serial.h(345): error C2065: 'DCB' : undeclared identifier
\serial.h(345): error C2070: 'unknown-type': illegal sizeof operand
There's also a whole lot more "undeclared identifiers" where that came from. I feel like there's a very obvious solution somewhere, either the way I have the solution set up or the linker or something. But it finds the file, it's just not interpreting it correctly it seems. When I take out
#include "Serial.h"
It compiles fine, so it has something to do with the way I'm adding that new header file. Any help would be much appreciated.

How to fix compile errors when including emscripten headers?

I'm trying to use emscripten Embind to bind C++ functions to JavaScript. Unfortunately I already get compile errors when including the specific header file with #include <emscripten/bind.h>.
I checked my emscripten environment and set an additonal Include Directory in VS2013 to the absolute path of the installation folder (also tried $(EMSCRIPTEN); and adapted the inlcude statement).
When compiling my project, I get 20+ compile errors:
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C2144: syntax error : 'bool' should be preceded by ';'
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(24): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C2146: syntax error : missing ';' before identifier 'TYPEID'
17> d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(42) : see reference to class template instantiation 'emscripten::internal::CanonicalizedID<T>' being compiled
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(39): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
17>d:\program files\emscripten\emscripten\1.25.0\system\include\emscripten\wire.h(54): error C2146: syntax error : missing ';' before identifier 'TYPEID'
...
I tried emscripten 1.22.0 and 1.25.0 and verified my emscripten environment following those instructions. What am I missing?
As far as I know, of the MS Visual Studio editions, only VS2010 is supported in Emscripten.
http://kripken.github.io/emscripten-site/docs/getting_started/getting_started_with_emscripten_and_vs2010.html#getting-started-emscripten-from-visual-studio

Winbase.h doesn't support in creating DLL file

I would like to create a project use to call c++ method using c#. So, I need to create a dll file for all of my c++ function. But when i get an error in y sqlite source code such as "AreFileApisASNSI undeclared identifier". So, i import winbase.h which is part of the mingw-w64 runtime package to my visual studio 2012 express DLL project. After import the file, I get many errors such as below:-
error c4430: missing type specifier - int assumed. Note: C++ does not support default - int
error C2143: syntax error : missing ';' before '_stdcall'
error c1003 error count exceeds 100; stopping compilation
error c2061: syntax error: identifier ' WINBOOL'
error c2086: 'int_CRT_INLINE' : redefinition
error c2143: syntax error: missing ';' before ''
error C2146: syntax error : missing ';' before identifier 'LONGLONG'
error C2146: syntax error : missing ';' before identifier 'PVOID'
any solution for those error? please help!!
The documentation for the function has this header requirement:
WinBase.h (include Windows.h)
This is telling you that the function is declared in WinBase.h, but that you should include Windows.h which in turn will include WinBase.h. So, you need to change your include to
#include <Windows.h>
I also wonder why you are talking about mingw considering that your compiler is MSVC. That compiler ships with a comprehensive Windows SDK. Why would you be using an SDK from mingw?

How do I make C++/wxWidgets code accessible to a wxPython app?

I have a code library which is written in C++ and makes extensive use of the wxWidgets library. I'm now trying to wrap my library (currently using SWIG) so that it's callable from wxPython, but I've hit a wall:
------ Build started: Project: MyLibLib, Configuration: Release_SWIG_OutputForBin Win32 ------
Performing Custom Build Step
In order to function correctly, please ensure the following environment variables are correctly set:
PYTHON_INCLUDE: C:\Python26\include
PYTHON_LIB: C:\Python26\libs\python26.lib
d:\MyProject\Software\MyLib\trunk\MyLib>C:\swigwin-2.0.0\swig.exe -python d:\MyProject\Software\MyLib\trunk\MyLibLib\MyLib.i
d:\MyProject\Software\MyLib\trunk\MyLib>if errorlevel 1 goto VCReportError
d:\MyProject\Software\MyLib\trunk\MyLib>goto VCEnd
Compiling...
MyLib_wrap.c
C:\wxWidgets-2.8.10\include\wx/wxchar.h(886) : warning C4273: '_snprintf' : inconsistent dll linkage
c:\Program Files\Microsoft Visual Studio 9.0\VC\include\stdio.h(358) : see previous definition of '_snprintf'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2061: syntax error : identifier 'wxCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2449: found '{' at file scope (missing function header?)
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : '}'
C:\wxWidgets-2.8.10\include\wx/buffer.h(127) : error C2059: syntax error : ')'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2061: syntax error : identifier 'wxWritableCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(129) : error C2059: syntax error : ':'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2061: syntax error : identifier 'wxWCharBuffer'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2059: syntax error : ';'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2449: found '{' at file scope (missing function header?)
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : error C2059: syntax error : '}'
C:\wxWidgets-2.8.10\include\wx/buffer.h(134) : fatal error C1004: unexpected end-of-file found
Build log was saved at "file://d:\MyProject\Software\MyLib\trunk\MyLib\Release_SWIG_OutputForBin\BuildLog.htm"
MyLibLib - 13 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Is there a particular way I should be going about this? I spent some time googling for similar errors, but got none which suggests I'm probably barking up the wrong tree here...?
[Edit] Is a dll and ctypes the answer?
[Edit] I tried including the main wx header in there, but it doesn't seem to fix the issue:
%{
#include <wx/wx.h>
%}
Am I going to have to go through and manually add each and every header from wxWidgets? Bear in mind there are a massive number of them!
Looks like your Mylib.i is not emitting in its generated C file to #include the header(s) defining wxCharBuffer and so on (or maybe missing #defines that make those include actually perform the needed function definitions, but that's less likely). Do you have the needed
%{
#include "wxwhatever.h"
%}
and so on in your .i file? Can you look at the generated .c and see what include directives are present or missing (or maybe in the wrong order)?
There's nothing especially tricky (that I know of) about the task you're attempting, and those error messages from the compiler just suggest to me "missing includes or the like"...

Compile errors in mshtml.h compiling with VS2008

I'm in the process of moving one of our projects from VS6 to VS2008 and I've hit the following compile error with mshtml.h:
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5272) : error C2143: syntax error : missing '}' before 'constant'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5275) : error C2143: syntax error : missing ';' before '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(5275) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2059: syntax error : '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2143: syntax error : missing ';' before '}'
1>c:\program files\microsoft sdks\windows\v6.0a\include\mshtml.h(28523) : error C2059: syntax error : '}'
Following the first error statement drops into this part of the mshtml.h code, pointing at the "True = 1" line:
EXTERN_C const GUID CLSID_CDocument;
EXTERN_C const GUID CLSID_CScriptlet;
typedef
enum _BoolValue
{ True = 1,
False = 0,
BoolValue_Max = 2147483647L
} BoolValue;
EXTERN_C const GUID CLSID_CPluginSite;
It looks like someone on expert-sexchange also came across this error but I'd rather not dignify that site with a "7 day free trial".
Any suggestions would be most welcome.
you might already have the symbols True & False defined, try
#undef True
#undef False
before including that file.
There is probably a #define changing something. Try running just the preprocessor on your .cpp and generating a .i file. The setting is in the project property pages.
EDIT: Also, you can get the answer from that other expert site by scrolling to the bottom of the page. They have to do that or Google will take them out of their indexes.
What other incodes do ou have in the currently compiling file? It may be that True has been defined by a macro already as 1. That would explain the error.
Thanks Guys. I found the right spot for those #undef's. I dropped them into the classes header file just before a #include <atlctl.h> that seemed to do the trick.
And thanks for the tip about that other expert site, I'll have to keep that in mind.