I read this article https://devblogs.microsoft.com/cppblog/cpp-modules-in-visual-studio-2017/
And I assume that this also applies to the Visual Studio 2019 Preview.
I was setting up a project to use a new experimental implementation of modules.
But my compiler does not compile this:
import std.core;
with errors:
1>C:\Users\Andrey\source\repos\MyCppTests\MyCppTests\MyCppTests.cpp(9): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>C:\Users\Andrey\source\repos\MyCppTests\MyCppTests\MyCppTests.cpp(9): error C2146: syntax error: missing ';' before identifier 'std'
I did enable /experimental:module option and /std:c++latest option.
But it still doesn't work. What am I doing wrong?
Thank you in advance!
My bad. I did enable /experimental:module option only for one build type but compiled in another.
Related
The point is that I try to build vlc-qt binding from source. I do the following:
Get libvlc-qt_0.10.0_win32_msvc2013.7z sources
Open my Qt5 Creator (from MVSC2013 version)
Open /src/CMakeLists.txt with it
Run CMake
Press build
Should work, but instead I get the following:
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_threads.h:403: ошибка: C3861: 'poll': identifier not found
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:103: ошибка: C2146: syntax error : missing ';' before identifier 'config_GetIntChoices'
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:103: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:104: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:105: ошибка: C2146: syntax error : missing ';' before identifier 'config_GetPszChoices'
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:105: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Program Files (x86)\VideoLAN\VLC\sdk\include\vlc\plugins\vlc_configuration.h:106: ошибка: C4430: missing type specifier - int assumed. Note: C++ does not support default-int
The surprises are that this project searches for some files in the current VLC player installation (Program Files is likely not the best place to get the dependecies), also that nothing's told about this behavior on the repository page, at first sight at at least.
Currently I'm trying to remove/reinstall player, run CMake with some keys etc. By the way, downloading CMake with gui never helped.
Could anyone, please, point me at the mistake in building. Thanks in advance.
UPD:
Thanks, krnekit, it helped to get the key! Ah, it occured to be even more complicated (msvc 2013 update 4 used).
Briefly:
It's pretty hard to build the binding from source via Qt Creator + nmake
Telling CMake with CMAKE_PREFIX_PATH variable, where qt required libraries are helps a lot
The problem of searching vlc player headers in sdk is solved similarly after some of the Cmake configuring
When I started building my sample with the vlc-qt sources included, instead of using the shared dll, I understood that /src/windows contains headers (poll.h and other) are requied to prevent the errors. Don't really know, why it didn't work with Cmake doing it instaed of me
This is a problem with vlc, not with vlc-qt. Your program should be compiled with at least VS 2013 Update 2 (or maybe even more recent).
Alternatively, the quick and dirty solution is to modify vlc includes, see this bugreport for details. You also should provide poll.h include file.
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
How does one start using the tr1 features of Visual Studio 2010? For a more specific case, I require the std::tr1::function. I tried including #include <tr1/functional> which reports as missing, while #include <functional> includes fine, but when I set this:
std::tr1::function<void(void)> callback;
I get:
1>d:\marmalade\projects\core\src\button.h(21): error C3083: 'tr1': the symbol to the left of a '::' must be a type
1>d:\marmalade\projects\core\src\button.h(21): error C2039: 'function' : is not a member of '_STL'
1>d:\marmalade\projects\core\src\button.h(21): error C2143: syntax error : missing ';' before '<'
1>d:\marmalade\projects\core\src\button.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\marmalade\projects\core\src\button.h(21): error C2238: unexpected token(s) preceding ';'
If I use boost, it works fine, but for this project, because of using a specific framework I'd require the Visual Studio tr1 version.
As suggested, skipping the tr1, still returns the same result:
std::function<void(void)> callback;
1>d:\marmalade\projects\core\src\button.h(20): error C2039: 'function' : is not a member of '_STL'
1>d:\marmalade\projects\core\src\button.h(20): error C2143: syntax error : missing ';' before '<'
1>d:\marmalade\projects\core\src\button.h(20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\marmalade\projects\core\src\button.h(20): error C2238: unexpected token(s) preceding ';'
Based on your comments, and on this page, I think that Marmalade comes with it's own STL implementation, that appears out of date. This page verifies that they use a version of STLPort, that does not support the TR1 that came out in 2005, much less anything newer. Your options are:
1) Copy/write those yourself
2) Do without
3) Download a newer version of STLPort. It doesn't seem to have been updated in the last two years, so no C++11, but they do mention having functional, but aren't clear as to if it's in the std or std::tr1 namespace. However, this might not work with Marmalade, so make backups and be careful.
Visual Studio 2010 ships with C++11 enabled by default (or at least what is implemented). You need to use std::function<void(void)>.
For a complete table see here.
As an aside: You shouldn't use anything from TR1 nowadays. It has been integrated into the new standard.
Trying to build a legacy code in VS2005 and get errors in VC header files.
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C2065: '_Sb' : undeclared identifier
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2176) : see reference to class template instantiation 'std::istreambuf_iterator<_Elem,_Traits>' being compiled
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C3861: '_Strbuf': identifier not found
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2096) : error C2061: syntax error : identifier '_Sb'
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2097) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2098) : error C2143: syntax error : missing ';' before '{'
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2098) : error C2334: unexpected token(s) preceding '{'; skipping apparent function body
d:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(2176) : fatal error C1075: end of file found before the left brace '{' at 'd:\Compilers\Microsoft Visual Studio 8\VC\include\xutility(15)' was matched
I find the legacy code uses a vector and if I comment out those variables then the code compiles without any errors.
I get these errors even if I just include vector header without defining any variable.
All the files in the project are cpp files.
Do I need to add some preprocessor directives or compiler settings to get this working?
You may find that running the pre-process phase on one of the files might show if any macros are being expanded that conflict with vector or _Strbuf. See my post on how to do this:
Compiling a project (VS 2008) with the /p argument (preprocess to a file) doesn't compile
You probably need to remove some conflicting predefined macros. Leading underscores followed by uppercase letters, as in _Sb are reserved for the implementation. If you have that defined as something else, you'll get such errors. It's also possible the errors are because you've defined _Strbuf ot _Got.
I'm getting a lot of errors compiling code using the boost libraries, mainly when I'm using Spirit namespace. The errors are syntax errors on boost files like:
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C2143: syntax error : missing ';' before '<'
or
boost/spirit/home/classic/dynamic/lazy.hpp(33) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
or
boost/spirit/home/classic/utility/grammar_def.hpp(104)
: error C2039: 'nil_t' : is not a
member of 'boost::phoenix'
I am migrating from Visual Studio 6 to Visual Studio 2008 Express and from one of the oldest versions of boost to the lastest.
I'd like to know what's the problem. I'm thinking the problem can't be in the boost library.
My guess, like Timi Geusch, is an errant #define.
I've never used VS, but if there is an option to see the code after it has been passed through the preprocessor, you might be able to figure out what causing the problem.
The problem was resolved just including phoenix1 the old version of phoenix.