c++ header file errors? - visual-c++

(Visual Studio c++ 6.0)
.\app.h(69) : error C2146: syntax error : missing ';' before identifier 'IsProcessRunning'
.\app.h(69) : error C2501: 'DWORD' : missing storage-class or type specifiers
.\app.h(69) : error C2061: syntax error : identifier 'LPCTSTR'
.\app.h(70) : error C2061: syntax error : identifier 'LPCTSTR'
Not sure why these errors? Why the syntax error? DWORD and LPCTSRT are recognized.
virtual BOOLEAN DoNew( void );
DWORD IsProcessRunning(LPCTSTR procname);
bool TerminateProcess(LPCTSTR procname);
void UpdateControllerStatus( void );

According to the errors, DWORD is not recognized. Are you sure you are including windows.h?

Add #include to the beginning of your code...

Related

Visual Studio warning C4596 in constructor declaration

Warning C4596 can, apparently, be solicited by several configuration. I found a few that did not match my problem so this is submited:
class dialog_base : public wxFrame
{
public:
dialog_base::dialog_base( const wxString& title );
… }
1> E:\WX\wx_numbers_01\dialog_base.h(18,28): warning C4596: '{ctor}': illegal qualified name in member declaration (compiling source file wx_numbers.cpp)
So how should this constructor be declared?
Just in case, as I read the error it comes from this part of the declaration:
dialog_base::dialog_base
I realize removing the "unexpected qualification" will resolve this warning. In your case, just use
dialog_base( const wxString& title );
May I know the reason why one would want to use
dialog_base::dialog_base( const wxString& title );

Why I am getting C3646 on an IAsyncAction declaration?

Probably a dumb question (WinRT noob), but, here is goes...
The code from "App.xaml.h" is:
namespace winrt::Precog::implementation
{
struct App : AppT<App>
{
App();
void OnLaunched(Microsoft::UI::Xaml::LaunchActivatedEventArgs const&);
private:
std::wstring cfgDatabase = L"";
winrt::Microsoft::UI::Xaml::Window window{ nullptr };
IAsyncAction loadSettings();
};
}
When I try to compile, Visual Studio gives me a C3646 (unknown override specifier) at the IAsyncAction declaration?
The loadSettings implementation is:
IAsyncAction App::loadSettings()
{
PHKEY regKey = NULL;
LSTATUS regResult;
regResult = RegCreateKey(HKEY_CURRENT_USER, L"Precog", regKey);
if (regResult != ERROR_SUCCESS)
{
ContentDialog errorDialog = ContentDialog();
errorDialog.Title(box_value(L"Erro"));
errorDialog.Content(box_value(L"Pateta"));
errorDialog.CloseButtonText(L"Ok");
errorDialog.XamlRoot(window.Content().XamlRoot());
auto result = co_await errorDialog.ShowAsync();
}
else
{
co_return;
}
}
EDIT: Full compiler output:
Build started...
1>------ Build started: Project: Precog, Configuration: Debug x64 ------
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2304,5): warning MSB3106: Assembly strong name "C:\Code\Precog\packages\Microsoft.WindowsAppSDK.1.0.0\build\native\..\..\lib\uap10.0\Microsoft.Windows.System.winmd" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
1>C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(2304,5): warning MSB3106: Assembly strong name "C:\Code\Precog\packages\Microsoft.WindowsAppSDK.1.0.0\build\native\..\..\lib\uap10.0\Microsoft.Windows.PushNotifications.winmd" is either a path which could not be found or it is a full assembly name which is badly formed. If it is a full assembly name it may contain characters that need to be escaped with backslash(\). Those characters are Equals(=), Comma(,), Quote("), Apostrophe('), Backslash(\).
1>App.xaml.cpp
1>C:\Code\Precog\Precog\Precog\App.xaml.h(17,22): error C3646: 'loadSettings': unknown override specifier
1>C:\Code\Precog\Precog\Precog\App.xaml.h(17,34): error C2059: syntax error: '('
1>C:\Code\Precog\Precog\Precog\App.xaml.h(17,36): error C2238: unexpected token(s) preceding ';'
1>C:\Code\Precog\Precog\Precog\App.xaml.cpp(35,19): error C2039: 'loadSettings': is not a member of 'winrt::Precog::implementation::App'
1>C:\Code\Precog\Precog\Precog\App.xaml.h(7): message : see declaration of 'winrt::Precog::implementation::App'
1>C:\Code\Precog\Precog\Precog\App.xaml.cpp(48,30): error C2065: 'window': undeclared identifier
1>Done building project "Precog.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Got it. It seemed to be a namespace mismatch, since changing the declaration to:
winrt::Windows::Foundation::IAsyncAction loadSettings();
Solved the problem. The interesting bit is that Intellisense does not catch the error (no red line underneath the type), only the compiler does.

PJSIP for Android (2019)

Is there a CMake version of the PJSIP library, or we should say goodbye to PJSIP for Android?
I've built the project using this helper and got the .so files, but this helper is a little old, besides it's output is not suitable for Android Studio.
I've swum in PJSIP website, but they provide no useful explanation among their vast nested documentation-called content.
I've tries to send a message to "benny#prijono.org", but this email address does not exist.
I've tried to subscribe to "lists.pjsip.org", but as you can guess, no help.
I've tried to reach PJSIP developers through "github", but none of them has provided a way to contact them.
I've also read the answers for similar questions on Stackoverflow, but no CMake file.
Should I be an expert on C programming to use this library, or I haven't spent enough time searching the Internet for a clear answer?
If you are using "pjproject v2.8" in an Android application, please share your knowledge. Thanks in advance.
I've spent a lot of time trying to build this library for Android.
I've been able to build PJSUA2 for arm64-v8a and armeabi-v7a architectures, but it fails with errors for x86_64 and x86.
I updated the repository with the latest release (2.9) in hope for the bug to be fixed. But the new version doesn't even build the *.a files.
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/cstddef:50:9: error: no member named
'ptrdiff_t' in the global namespace
using ::ptrdiff_t;
~~^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/cstddef:51:9: error: no member named
'size_t' in the global namespace
using ::size_t;
~~^
In file included from ../../yuv/source/compare.cc:14:
In file included from /home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/math.h:309:
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:763:22: error: unknown type
name 'size_t'
template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS is_array<_Tp[_Np]>
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1282:32: error: use of
undeclared identifier 'size_t'; did you mean 'sizeof'?
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1282:38: error: expected
expression
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1282:43: error: expected
class name
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1284:32: error: use of
undeclared identifier 'size_t'; did you mean 'sizeof'?
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1284:38: error: expected
expression
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1284:49: error: expected
class name
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1285:22: error: unknown
type name 'size_t'
template <class _Tp, size_t _Np> struct _LIBCPP_TEMPLATE_VIS rank<_Tp[_Np]>
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1286:32: error: use of
undeclared identifier 'size_t'; did you mean 'sizeof'?
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1286:38: error: expected
expression
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1286:49: error: expected
class name
: public integral_constant<size_t, rank<_Tp>::value + 1> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1297:32: error: use of
undeclared identifier 'size_t'; did you mean 'sizeof'?
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1297:38: error: expected
expression
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1297:43: error: expected
class name
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1299:32: error: use of
undeclared identifier 'size_t'; did you mean 'sizeof'?
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1299:38: error: expected
expression
: public integral_constant<size_t, 0> {};
^
/home/adminz/android/sdk/ndk/20.0.5594570/sources/cxx-stl/llvm-libc++/include/type_traits:1299:43: error: expected
class name
: public integral_constant<size_t, 0> {};
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
Before I update my svn repo with the release version, errors where as follows:
/home/adminz/android/pjsip/third_party/lib/libwebrtc-x86_64-pc-linux-android.a(aec_core.o):aec_core.c:function WebRtcAec_CreateAec: error: undefined reference to 'WebRtc_GetCPUInfo'
/home/adminz/android/pjsip/third_party/lib/libwebrtc-x86_64-pc-linux-android.a(aec_core.o):aec_core.c:function WebRtcAec_CreateAec: error: undefined reference to 'WebRtcAec_InitAec_SSE2'
/home/adminz/android/pjsip/third_party/lib/libwebrtc-x86_64-pc-linux-android.a(aec_rdft.o):aec_rdft.c:function aec_rdft_init: error: undefined reference to 'WebRtc_GetCPUInfo'
/home/adminz/android/pjsip/third_party/lib/libwebrtc-x86_64-pc-linux-android.a(aec_rdft.o):aec_rdft.c:function aec_rdft_init: error: undefined reference to 'aec_rdft_init_sse2'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:165: recipe for target 'android/app/src/main/jniLibs/x86_64/libpjsua2.so' failed
Should we also try to fix the library inner errors?
My final conclusion is that PjProject is a contraption (for some platforms) and it's developers don't even test the release version much enough and they use the users as their test case. I'm so frustrated with pjsip. So many features as some no-useful packages.

vc++ undeclared indentifier 2015

Need help to resolve an error.
Currently I am working on a migration project from visual c++ 6.0 to visual studio c++ 2005.
And during compilation, I am getting "Undeclared Identifier Error"
I am hearing pasting the code and error.
code
const SMbfIndexCash* GetIxCashed(const CPoint& ptIxBlock, const short nMbfID)
{
SMbfIndexCash* pCashFound;
for(int ixFound=0; ixFound<MBF_IX_CASH_SIZE; ixFound++)
{
pCashFound=&ElementAt(ixFound);
if(pCashFound->nAge<0)
return NULL;
if(nMbfID==pCashFound->nMbfID && ptIxBlock==pCashFound->ptIxBlock)
break;
}
if(ixFound==MBF_IX_CASH_SIZE)
return NULL;
}
Error.
1>c:\cm and nemesis\cm code\cm 8.16\cm
8.16.0.1\source\cmoslib\tile.h(466) : error C2065: 'ixFound' :
undeclared identifier
Thank you.
The ixFound is now local to the scope of the for loop.
you need to do something like:
int ixFound = 0;
for(ixFound=0; ixFound<MBF_IX_CASH_SIZE; ixFound++)
{
//...
}
//...

error C3699: '^' : cannot use this indirection on type 'std::string'

I am trying to access lync from my application in this code I am getting errors.
error C3699: '^' : cannot use this indirection on type 'std::string'
error C2440: 'initializing' : cannot convert from 'System::String ^' to 'std::string *'
1> No user-defined-conversion operator available, or
1> Cannot convert a managed type to an unmanaged type
My code is as follows:
#using <Microsoft.Lync.Model.dll>
#using <Microsoft.Lync.Utilities.dll>
//namespace provided that DLL
using namespace Microsoft::Lync::Model;
//Function which is using that DLL
void getusername()
{
LyncClient ^lyncClient;
string ^text=lyncClient->Self->Contact->GetContactInformation(ContactInformationType::DisplayName)->ToString();
}
ToString() is returning a managed System::String type. This is different from the unmanaged std::string type.
To convert from one to the other, use marshal_as.

Resources