I have been using VS 2008, and have installed VS 2015 side by side on the same computer. I have projects compiled in VS 20015 from another computer that compile just fine. But when I open those projects and try to compile them in the new VS 2015 on this computer they will not compile. In fact, even creating the simplest "Hello world" application will not compile.
I get errors on standard VS header files. For example, it throws errors and warnings on Windows.h like:
Warning C4067 unexpected tokens following preprocessor directive -
expected a newline windows.h
Error C2061 syntax error: identifier 'LPCSTR'
Error C2061 syntax
error: identifier 'BYTE'
I can't figure out why this is happening. Anyone have an idea?
Related
I am trying to load an image from an url and display it.I am using opencv in c++ and cURL libraries.I am used to working with opencv,but I don't have any experience working with cURL libraries. I just need curl to load an image and save it in a cv::Mat file, so that I could display it. So, I took code from here.It is supposed to be working,but I am getting syntax errors.
Also,I tried this code from opencv.org. But,I am getting same errors
Errors are
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2061: syntax error : identifier 'acosf'
1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\cmath(19): error C2059: syntax error : ';'
and about 90 syntax errors.When I click on errors it is opening cmath file and I cant find any syntax errors there.
Thank you for the help.
EDIT 1: I compiled the code as c++ and got rid of the above errors.Now I got a new error
OpenCV Error: Assertion failed (buf.data && buf.isContinuous()) in cv::imdecode_, file ........\opencv\modules\highgui\src\loadsave.cpp
It looks like you are compiling for c and not c++. Check two things:
Code file extension is .cpp and not .c.
Check the compilation properties:
Tools bar -> Project -> Properties (or Alt + F7)->Configuration Properties -> C/C++ -> Advanced -> Compile As: "Compile as C++ Code".
I am facing this error message:
error C1001: An internal error has occurred in the compiler
It appears just in the Debug mode. There is no clue about why this is happening. The compiler does not give me any hint to the line. When I click on the error it is take me to blank file called xxx.obj.
The platform:
Visual Studio 2013
Intel i7
Windows 8
I figured the problem after digging into the warnings I am getting. There was a suspecios one which is:
warning C4239: nonstandard extension used : 'argument' :
conversion from 'T' to 'T&'
This warning is because of this line:
auto x = foo(bar{});
the function foo is declared as follow:
int foo(bar&);
This behavouir is not standared as was discuueed here: Is it possible to know if the parameter was defaulted . However, MSVS supports this behaviour as non-standard extension.
Usually it works well without any problem but due to non-known thing in this project it did not work.
After correcting it with these two lines:
bar temp{};
auto x = foo(temp);
Everything worked well.
I have working code that runs fine on Linux but when I try to compile it in Windows 7 with Visual Studio 12 I get this error:
error C3646: '__attribute__' : unknown override specifier
error C2065: 'weak' : undeclared identifier
error C2072: 'operator <<' : initialization of a function
Does anyone know what could be causing this?
__attribute__ Is GCC specific. It's a non standard extension.
That's why MSVC is complaining.
Here is a good answer on how to find a workaround to have the equivalent working on Visual Studio for.
In fact, it depends of your usage of the __attribute__ extension. But it is difficult to find an equivalent in MSVC.
I am trying to compile some MATLAB MEX files from C++ source. The files I am trying to compile can be found here; I am using Windows XP on a 32-bit system, MATLAB 2012a and have installed the Microsoft Windows SDK v7.1 to use as my compiler.
MATLAB outputs the following error if I try to compile:
>> mex -O -largeArrayDims osc_free_address.c
osc_free_address.c
osc_free_address.c(1) : error C2059: syntax error : '<'
osc_free_address.c(37) : error C2015: too many characters in constant
osc_free_address.c(38) : error C2059: syntax error : '<'
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(39) : error C2015: too many characters in constant
osc_free_address.c(41) : error C2018: unknown character '0x40'
osc_free_address.c(43) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(44) : error C2015: too many characters in constant
osc_free_address.c(46) : error C2059: syntax error : '<'
osc_free_address.c(82) : fatal error C1021: invalid preprocessor command 'page'
C:\PROGRA~1\MATLAB\R2012A\BIN\MEX.PL: Error: Compile of 'osc_free_address.c' failed.
Error using mex (line 206)
Unable to complete successfully.
I have used mex -setup to setup my compiler with Microsoft Windows SDK v7.1. Interestingly, although I have them installed on my system, MATLAB doesn't see MS Visual Studio C++ 2008 or 2010. I have also tried compiling with the Lcc-win32 C 2.4.1 compiler (which is recognised by MATLAB), to the same effect as shown above.
I understand that this particular set of C++ source files might require something called liblo to compile (I'm not sure whether this is a requirement at compile-time or run-time); as far as I'm aware I have installed these correctly, but there's a possibility that the problem might lie here too.
Any help would be greatly appreciated.
Try renaming your .c files to .cpp and re-compile
>> mex -largeArrayDims -O osc_free_address.cpp
Moreover, why don't you try the build m file that comes with the package
(as suggested in this question)?
Have you downloaded and compiled liblo? you might need to add the include path and library path for it in the mex command?
>> mex -largeArrayDims -O -I<liblo include path> -L<liblo lib path> -llo osc_free_address.cpp
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.