Getting started with GRETA Regular Expression Library - cl.exe

I'm required to work on GRETA Regular Expression Library, provided by Microsoft Research. I was unable to compile and run the sample program when used cl.exe provided with Visual Studio 2008. It gave some errors like:
D:\greta\greta-2.6.4>cl /EHsc num_match.cpp
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.21022.08 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
num_match.cpp
d:\greta\greta-2.6.4\restack.h(355) : warning C4346: 'regex::hetero_stack<Alignm
entT,RuntimeTypeCheckT,AssumePodT,DynamicBlockSizeT,StaticBlockSizeT>::stack_nod
e::header' : dependent name is not a type
prefix with 'typename' to indicate a type
d:\greta\greta-2.6.4\restack.h(854) : see reference to class template in
stantiation 'regex::hetero_stack<AlignmentT,RuntimeTypeCheckT,AssumePodT,Dynamic
BlockSizeT,StaticBlockSizeT>' being compiled
d:\greta\greta-2.6.4\restack.h(355) : error C2923: 'regex::hetero_stack<Alignmen
tT,RuntimeTypeCheckT,AssumePodT,DynamicBlockSizeT,StaticBlockSizeT>::aligned_siz
eof' : 'regex::hetero_stack<AlignmentT,RuntimeTypeCheckT,AssumePodT,DynamicBlock
SizeT,StaticBlockSizeT>::stack_node::header'
It is not a valid template type argument for parameter 'T'.
Can anybody help me to get started with GRETA?

Related

Building/linking errors with the Vivek's Vcam / Capture Source Filtet

I'm struggling to build/link Vivek's Vcam / Capture Source Filter on Windows 10 with Visual Studio 2019 (Version 16.5.5) for x64 platforms.
(I have already built the BaseClasses project with no issues.)
These are the current building errors:
>Dll.cpp
>(folder)\vsprojects\sdk7samples\baseclasses\transip.h(214,55): error C4596: 'Copy': illegal qualified name in member declaration
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): error C2385: ambiguous access of '{dtor}'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): message : could be the '{dtor}' in base 'IDirectDraw'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): message : or could be the '{dtor}' in base 'CUnknown'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,47): error C3254: 'CAggDirectDraw': class contains explicit override '{dtor}' but does not derive from an interface that contains the function declaration
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,47): error C3244: 'CAggDirectDraw::~CAggDirectDraw(void)': this method was introduced by '<Unknown>' not by 'IDirectDraw'
>(folder)\references\vcam\Filters\Dll.cpp(48,5): error C2440: 'initializing': cannot convert from 'const wchar_t [7]' to 'LPWSTR'
>(folder)\references\vcam\Filters\Dll.cpp(48,5): message : Conversion from string literal loses const qualifier (see /Zc:strictStrings)
>Filters.cpp
>(folder)\vsprojects\sdk7samples\baseclasses\transip.h(214,55): error C4596: 'Copy': illegal qualified name in member declaration
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): error C2385: ambiguous access of '{dtor}'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): message : could be the '{dtor}' in base 'IDirectDraw'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,44): message : or could be the '{dtor}' in base 'CUnknown'
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,47): error C3254: 'CAggDirectDraw': class contains explicit override '{dtor}' but does not derive from an interface that contains the function declaration
>(folder)\vsprojects\sdk7samples\baseclasses\videoctl.h(54,47): error C3244: 'CAggDirectDraw::~CAggDirectDraw(void)': this method was introduced by '<Unknown>' not by 'IDirectDraw'
>Done building project "vcam.vcxproj" -- FAILED.
On C++ additional include directories I have "..\sdk7samples\baseclasses\;%(AdditionalIncludeDirectories)".
On Linker's additional library directories I have "..\sdk7samples\baseclasses\x64\Release\;%(AdditionalLibraryDirectories)".
On Linker's addidional dependencies I added strmbasd.lib (debug profile) / strmbase.lib (release profile).
Any suggestions? Thanks!
Try to disable "Conformance mode" in properties(From Yes(/permissive-) to No).
I can reproduce this issue and then get it compile after disable it.
This compiler option is set by default in Visual Studio 2017 version 15.5 and later, but it is not set by default in earlier versions.
According to the /permissive document:
By default, the /permissive- option is set in new projects created by
Visual Studio 2017 version 15.5 and later versions. It's not set by
default in earlier versions. When the option is set, the compiler
generates diagnostic errors or warnings when non-standard language
constructs are detected in your code, including some common bugs in
pre-C++11 code.
...Older versions of the SDK may fail to compile under /permissive-
for various source code conformance reasons.

Standard library identifiers conflict with user identifiers

I am attempting to compile/link my file named test.cpp from the command line using VS2017 on a 64-bit Win10 system. I use these two commands:
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cl test.cpp
and I get the following results:
C:\temp\tests>"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.4.5
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Environment initialized for: 'x64'
C:\temp\tests>cl test.cpp
Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25547 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
test.cpp
test.cpp(2): error C2365: 'y1': redefinition; previous definition was 'function'
C:\Program Files (x86)\Windows
Kits\10\include\10.0.16299.0\ucrt\corecrt_math.h(984): note: see declaration of 'y1'
test.cpp(5): error C2659: '=': function as left operand
My file contains the following code:
#include <new>
static int *y1;
int main()
{
y1 = new (std::nothrow) int;
}
While I understand why this is happening and any number of kluges that will fix it, it seems to me that the actual defect is in the Microsoft corecrt_math.h header file. When I look there I see several more identifiers (j0, jn, jn, etc.) that could just as easily be legitimately chosen by an unsuspecting programmer, only to end up with the same problem. I was under the impression that there was a "gentlemen's agreement" that exposed undocumented identifiers in library code would start or end with an underbar and user code would not, just to avoid this type of problem.
This build command works for me:
cl foo.cpp /Feb /D _CRT_DECLARE_NONSTDC_NAMES=0

How to undecorate linker object names in Visual Studio?

To undecorate mangled C++ names that Visual Studio generates in compiled libraries, one can use undname.exe. However, I am having an issue identifying the unmangled names if the library cannot compile due to unresolved external symbols.
Example:
Error LNK2001 unresolved external symbol __imp_ldap_value_free_len libcurl.lib(ldap.obj)
When try to I undecorate that name, I get the following:
C:\Program Files (x86)\Microsoft Visual Studio 14.0>undname.exe __imp_ldap_value_free_len
Microsoft (R) C++ Name Undecorator
Copyright (C) Microsoft Corporation. All rights reserved.
Undecoration of :- "__imp_ldap_value_free_len"
is :- "__imp_ldap_value_free_len"
This shows that the linker uses a different mangling format for intermediary object files. How do I obtain the original method header?
The important thing to realize about names of the form __imp_ldap_value_free_len is to drop the __imp_ prefix and figure out where the remaining symbol name comes from. And indeed there is a ldap_value_free_len in Wldap32.dll (you link against Wldap32.lib).

Strange issue with abs(complex) in Visual Studio C++ 2015 Update 3

After updating to Visual Studio 2015 Update 3 (from Visual Studio 2015), this code no longer compiles:
#include<cmath>
#include<complex>
int main()
{
std::complex<double> update(0.0, 0.0);
double x = std::abs(update);
return 1;
}
I am getting the following error when running the compiler:
c:\projects\foo\win64>cl /EHsc /fp:strict foo.cc
Microsoft (R) C/C++ Optimizing Compiler Version 19.00.24213.1 for x86
Copyright (C) Microsoft Corporation. All rights reserved.
foo.cc
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xcomplex(232): er
ror C2131: expression did not evaluate to a constant
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xcomplex(232): no
te: failure was caused by an undefined arithmetic operation
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE\xcomplex(253): no
te: see reference to function template instantiation '_Ty std::_Fabs<double>(con
st std::complex<double> &,int *)' being compiled
with
[
_Ty=double
]
foo.cc(6): note: see reference to function template instantiation '_Ty std::abs<
double>(const std::complex<double> &)' being compiled
with
[
_Ty=double
]
This issue seems to be tied with my usage of fp:strict, which is necessary for proper IEEE floating point. Is this an issue with my code?
I test it in VS2013 with update 5 and VS2015 with update 3, it really has this issue in VS2015, but everything compiled normally in VS2013 with the same property settings /fp:strict. I help you submit a new feedback to the connect report here:
https://connect.microsoft.com/VisualStudio/feedbackdetail/view/3101450/c2131-expression-did-not-evaluate-to-a-constant-error-in-vs2015-update-3
Maybe the report team could provide better solution for this issue. You could vote it.

The system cannot find the file specified in Visual Studio 2013 C++

I am learning C++ for the first day, went on to type in this code from the first Chapter of "C++ A Beginner's Guide":
#include <iostream>
using namespace std;
int main()
{
cout << "C++ is power prgramming.";
return 0;
}
then when I debug it, I get an error message saying:
"Unable to start program 'F:\Documents\Visual Studio 2013\Projects\Projects1\Debug\Project1.exe'.
The system cannot find the file specified."
The error in output shows:
1>CL : Command line warning D4024: unrecognized source file type '?', object file assumed
1> Microsoft (R) Incremental Linker Version 12.00.31101.0
1> Copyright (C) Microsoft Corporation. All rights reserved.
1>
1> /out:
1> ?.exe
1>LINK : fatal error LNK1146: no argument specified with option '/out:'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I looked though a few posts that seems similar but none of the answers helped me. I had tried to add Additional Library Directories in the properties but still doesn't help. Tried compiling before debugging but still same error came out.
I just installed Visual Studio today so there is not point of restoring Default.
What else can I do?
Thanks very much.