minGW error on locale library - c++

I changed from using Dev-c++ to visual studio code. But it seems i can't compile the minGW because of this bug, i got this bug if i use sublime too. Please help me with this.
*sorry for my bad english
C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\locale.h:36:13: warning: #pragma system_header ignored outside include file
#pragma GCC system_header
^~~~~~~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h:41:0,
from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\localefwd.h:40,
from C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\locale.h:38:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\clocale:53:11: error: '::lconv' has not been declared
using ::lconv;
^~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\clocale:54:11: error: '::setlocale' has not been declared
using ::setlocale;
^~~~~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\clocale:55:11: error: '::localeconv' has not been declared
using ::localeconv;
^~~~~~~~~~
In file included from c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\bits\localefwd.h:40:0,
from C:\MinGW\lib\gcc\mingw32\6.3.0\include\c++\locale.h:38:
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h: In function 'int std::__convert_from_v(int* const&, char*, int, const char*, ...)':
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h:60:19: error: 'setlocale' is not a member of 'std'
char* __old = std::setlocale(LC_NUMERIC, 0);
^~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h:60:34: error: 'LC_NUMERIC' was not declared in this scope
char* __old = std::setlocale(LC_NUMERIC, 0);
^~~~~~~~~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h:67:2: error: 'setlocale' is not a member of 'std'
std::setlocale(LC_NUMERIC, "C");
^~~
c:\mingw\lib\gcc\mingw32\6.3.0\include\c++\mingw32\bits\c++locale.h:83:2: error: 'setlocale' is not a member of 'std'
std::setlocale(LC_NUMERIC, __sav);
^~~

Related

how to build p7 library with mingw?

Im trying to build p7 logger on my windows 10 for using with project that builds with mingw 11.2.0 x64 under QT 6.3.0. Build works with VS2015 14.0.25431.01, but it's soo many linker errors while trying to use the build in project. Actualy it looks like no one method from lib hasn't defined reference:
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x73): undefined reference to `__imp__invalid_parameter_noinfo'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xe1): undefined reference to `__imp__invalid_parameter_noinfo'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x127): undefined reference to `__imp__invalid_parameter_noinfo'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x82e): undefined reference to `?Get_ArgV#CProc##SAPEAPEA_WPEB_WPEAH#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x350): undefined reference to `_vsnwprintf'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x863): undefined reference to `?Get_ArgV#CProc##SAPEAPEA_WPEAH#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xdfd): undefined reference to `wprintf'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xe0f): undefined reference to `?Free_ArgV#CProc##SAXPEAPEA_W#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xe2a): undefined reference to `?Free_ArgV#CProc##SAXPEAPEA_W#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xe66): undefined reference to `_RTC_CheckStackVars'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xf28): undefined reference to `?Get_Process_Time#CProc##SAIPEAI0#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xf92): undefined reference to `?Lock#CShared##SA?AW4eLock#1#PEB_WAEAPEAXI#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0xfad): undefined reference to `?Read#CShared##SAIPEB_WPEAEG#Z'
C:\dev\qt\projects\SnakemanSignature\libs\libP7Client_v5.6\Libs/p7.lib(p7.dir/Debug/Client.obj):(.text$mn+0x1006): undefined reference to `?UnLink#CShared##SAIPEB_W#Z'
There are 1361 error's like that.
I think problem in using different compilators for lib and project.
Tryna build p7 with mingw32-make, but it requires some <strsafe.h>, got header from here: There is no strsafe.h in MinGW? What to use instead?
and stored it in mingw's include folder.
Aaand here we go again, huh! All brand new errors:
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:39:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'wchar_t* PStrCpy(wchar_t*, size_t, const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:47:57: error: 'wcscpy_s' was not declared in this scope
wcscpy_s((wchar_t*)i_pDst, i_szDst, (wchar_t*)i_pSrc);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'wchar_t* PWStrCpy(tWCHAR*, size_t, const tWCHAR*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:59:57: error: 'wcscpy_s' was not declared in this scope
wcscpy_s((wchar_t*)i_pDst, i_szDst, (wchar_t*)i_pSrc);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'wchar_t* PStrNCpy(wchar_t*, size_t, const wchar_t*, size_t)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:72:74: error: 'wcsncpy_s' was not declared in this scope
wcsncpy_s((wchar_t*)i_pDst, i_szDst, (wchar_t*)i_pSrc, i_pSrcMaxCount);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'void PUStrCpy(tWCHAR*, tUINT32, const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:124:52: error: 'wcscpy_s' was not declared in this scope
wcscpy_s((wchar_t *)i_pDst, i_dwMax_Len, i_pSrc);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'tINT32 PSPrint(wchar_t*, size_t, const wchar_t*, ...)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:140:54: error: '_TRUNCATE' was not declared in this scope
l_iReturn = _vsnwprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, l_pVA);
^~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:140:81: error: '_vsnwprintf_s' was not declared in this scope
l_iReturn = _vsnwprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, l_pVA);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'tINT32 PSPrint(tACHAR*, size_t, const tACHAR*, ...)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:159:53: error: '_TRUNCATE' was not declared in this scope
l_iReturn = _vsnprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, l_pVA);
^~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:159:80: error: '_vsnprintf_s' was not declared in this scope
l_iReturn = _vsnprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, l_pVA);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h: In function 'int PVsnprintf(wchar_t*, size_t, const wchar_t*, va_list)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:180:49: error: '_TRUNCATE' was not declared in this scope
return _vsnwprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, i_pArgs);
^~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PString.h:180:78: error: '_vsnwprintf_s' was not declared in this scope
return _vsnwprintf_s(o_pBuffer, i_szBuffer, _TRUNCATE, i_pFormat, i_pArgs);
^
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:44:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PThreadShell.h: In static member function 'static tBOOL CThShell::Create(CThShell::tpThreadProc, void*, void**, const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PThreadShell.h:45:39: warning: unused parameter 'i_pName' [-Wunused-parameter]
const tXCHAR *i_pName
^~~~~~~
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:47:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h: In static member function 'static tBOOL CShared::Create(CShared::sShared**, const wchar_t*, const tUINT8*, tUINT16)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:108:18: error: 'ERROR_ALREADY_EXISTS' was not declared in this scope
|| (ERROR_ALREADY_EXISTS == GetLastError())
^~~~~~~~~~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:130:18: error: 'ERROR_ALREADY_EXISTS' was not declared in this scope
|| (ERROR_ALREADY_EXISTS == GetLastError())
^~~~~~~~~~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:152:9: error: '__try' was not declared in this scope
__try
^~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:157:39: error: 'GetExceptionCode' was not declared in this scope
__except ( GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:160:18: error: '__except' was not declared in this scope
)
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h: In static member function 'static tBOOL CShared::Read(const wchar_t*, tUINT8*, tUINT16)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:258:9: error: '__try' was not declared in this scope
__try
^~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:263:40: error: 'GetExceptionCode' was not declared in this scope
__except ( (GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR)
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:266:18: error: '__except' was not declared in this scope
)
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h: In static member function 'static tBOOL CShared::Write(const wchar_t*, const tUINT8*, tUINT16)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:355:9: error: '__try' was not declared in this scope
__try
^~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:360:40: error: 'GetExceptionCode' was not declared in this scope
__except ( (GetExceptionCode() == EXCEPTION_IN_PAGE_ERROR)
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:363:18: error: '__except' was not declared in this scope
)
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h: In static member function 'static CShared::eLock CShared::UnLock(void*&)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:463:17: warning: unused variable 'l_hMutex' [-Wunused-variable]
HANDLE l_hMutex = NULL;
^~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h: In static member function 'static tBOOL CShared::Create_Name(wchar_t*, size_t, CShared::eType, const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:583:23: error: 'swprintf_s' was not declared in this scope
);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PShared.h:594:23: error: 'swprintf_s' was not declared in this scope
);
^
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:52:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PFileSystem.h: In static member function 'static tBOOL CFSYS::Get_TextResource(const wchar_t*, const wchar_t*, wchar_t*, size_t)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PFileSystem.h:430:19: error: 'swprintf_s' was not declared in this scope
);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PFileSystem.h:438:99: error: 'wcsncpy_s' was not declared in this scope
wcsncpy_s(o_pBuffer, i_szBuffer, l_pValue, (l_dwSize > i_szBuffer) ? i_szBuffer : l_dwSize);
^
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:54:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h: At global scope:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h:297:12: error: '__forceinline' does not name a type
static __forceinline tUINT32 Get_Processor()
^~~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h: In static member function 'static tBOOL CProc::Get_Process_Name(tWCHAR*, tINT32)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h:216:68: error: 'wcscpy_s' was not declared in this scope
wcscpy_s((wchar_t*)o_pName, i_iMax_Len, l_pProcess_Name);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h: In static member function 'static tBOOL CProc::Get_Process_Name(tACHAR*, tINT32)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h:238:32: error: 'rsize_t' was not declared in this scope
strcpy_s(o_pName, (rsize_t)i_iMax_Len, "Unknown:Error");
^~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PProcess.h:238:67: error: 'strcpy_s' was not declared in this scope
strcpy_s(o_pName, (rsize_t)i_iMax_Len, "Unknown:Error");
^
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\Common.h:56:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:33,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In constructor 'CJournal::CJournal()':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:93:110: error: 'wcscpy_s' was not declared in this scope
wcscpy_s(m_pTypes_Description[IJournal::eLEVEL_TRACE], FJOURNAL_DESCRIPTION_MAX_LENGTH, L"INFO : ");
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'virtual tBOOL CJournal::Initialize(const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:170:28: error: 'swprintf_s' was not declared in this scope
);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'virtual tBOOL CJournal::Log(IJournal::eLevel, IJournal::hModule, const char*, const char*, tUINT32, const wchar_t*, ...)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:313:34: error: 'swprintf_s' was not declared in this scope
);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:338:34: error: 'swprintf_s' was not declared in this scope
);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:254:33: warning: unused parameter 'i_hModule' [-Wunused-parameter]
IJournal::hModule i_hModule,
^~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:255:33: warning: unused parameter 'i_pFile' [-Wunused-parameter]
const char *i_pFile,
^~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'virtual tBOOL CJournal::Register_Thread(const wchar_t*, tUINT32)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:443:41: warning: unused parameter 'i_pName' [-Wunused-parameter]
tBOOL Register_Thread(const tXCHAR *i_pName, tUINT32 i_dwThreadId)
^~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:443:58: warning: unused parameter 'i_dwThreadId' [-Wunused-parameter]
tBOOL Register_Thread(const tXCHAR *i_pName, tUINT32 i_dwThreadId)
^~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'virtual tBOOL CJournal::Unregister_Thread(tUINT32)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:449:37: warning: unused parameter 'i_dwThreadId' [-Wunused-parameter]
tBOOL Unregister_Thread(tUINT32 i_dwThreadId)
^~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'virtual tBOOL CJournal::Register_Module(const wchar_t*, void**)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:455:41: warning: unused parameter 'i_pName' [-Wunused-parameter]
tBOOL Register_Module(const tXCHAR *i_pName, IJournal::hModule *o_hModule)
^~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'DWORD CJournal::Copy_Bufer(BOOL)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:543:115: error: 'memcpy_s' was not declared in this scope
memcpy_s(m_pWrite_Buffer, FJOURNAL_FILE_BUFFER_LENGTH * sizeof(wchar_t), m_pJournal_Buffer, l_dwResult);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h: In member function 'BOOL CJournal::Remove_Old_Journals(wchar_t*, DWORD, const wchar_t*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:613:108: error: 'swprintf_s' was not declared in this scope
swprintf_s(m_pJournal_Buffer, FJOURNAL_FILE_BUFFER_LENGTH, L"%s\\*.%s", i_pFolder, i_pExtension);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:624:79: error: 'wcscpy_s' was not declared in this scope
wcscpy_s(l_pFileName, MAX_PATH, l_tFind_Info.cFileName);
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PJournal.h:648:56: error: 'wcscpy_s' was not declared in this scope
wcscpy_s(l_pFileName, MAX_PATH, L"9999");
^
In file included from C:/dev/qt/pkg/libP7Client_v5.6/Shared/UDP_NB.h:22:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:35,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h: At global scope:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:42:9: error: 'addrinfoW' does not name a type
typedef addrinfoW tADDR_INFO;
^~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h: In function 'tBOOL PEnumIpsHlp(const char*, CBList<sockaddr_storage*>*)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:134:62: error: 'getaddrinfo' was not declared in this scope
if (0 == getaddrinfo(i_pHost, l_pPort, &l_tHint, &l_pInfo))
^
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:163:29: error: 'freeaddrinfo' was not declared in this scope
freeaddrinfo(l_pInfo);
^
In file included from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:37:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSystem.h: In static member function 'static tBOOL CSys::Get_Host_Name(tACHAR*, size_t)':
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSystem.h:55:56: error: 'strcpy_s' was not declared in this scope
strcpy_s(o_pName, i_szName, "Unknown:Error");
^
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp: In member function 'eClient_Status CClBaical::Init_Sockets(wchar_t**, tINT32)':
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:260:9: error: 'tADDR_INFO' was not declared in this scope
tADDR_INFO *l_pInfo = NULL;
^~~~~~~~~~
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:260:21: error: 'l_pInfo' was not declared in this scope
tADDR_INFO *l_pInfo = NULL;
^~~~~~~
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:261:21: error: 'l_pNext' was not declared in this scope
tADDR_INFO *l_pNext = NULL;
^~~~~~~
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:262:21: error: expected ';' before 'l_tHint'
tADDR_INFO l_tHint;
^~~~~~~
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:264:17: error: 'l_tHint' was not declared in this scope
memset(&l_tHint, 0, sizeof(l_tHint));
^~~~~~~
In file included from C:/dev/qt/pkg/libP7Client_v5.6/Shared/UDP_NB.h:22:0,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\CommonClient.h:35,
from C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:24:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:57:76: error: 'GetAddrInfoW' was not declared in this scope
o_Res)
^
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:297:18: note: in expansion of macro 'GET_ADDR_INFO'
if (0 == GET_ADDR_INFO(l_pAddr, l_pPort, &l_tHint, &l_pInfo))
^~~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:59:52: error: 'FreeAddrInfoW' was not declared in this scope
#define FREE_ADDR_INFO(i_Info) FreeAddrInfoW(i_Info)
^
C:\dev\qt\pkg\libP7Client_v5.6\Sources\ClBaical.cpp:330:13: note: in expansion of macro 'FREE_ADDR_INFO'
FREE_ADDR_INFO(l_pInfo);
^~~~~~~~~~~~~~
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h: At global scope:
C:/dev/qt/pkg/libP7Client_v5.6/Shared/Platforms/Windows_x86/PSocket.h:176:14: warning: 'tBOOL PEnumIps(CBList<sockaddr_storage*>*)' defined but not used [-Wunused-function]
static tBOOL PEnumIps(CBList<sockaddr_storage*> *io_pList)
^~~~~~~~
Sources\CMakeFiles\p7.dir\build.make:90: recipe for target 'Sources/CMakeFiles/p7.dir/ClBaical.cpp.obj' failed
mingw32-make[2]: *** [Sources/CMakeFiles/p7.dir/ClBaical.cpp.obj] Error 1
CMakeFiles\Makefile2:132: recipe for target 'Sources/CMakeFiles/p7.dir/all' failed
mingw32-make[1]: *** [Sources/CMakeFiles/p7.dir/all] Error 2
Makefile:134: recipe for target 'all' failed
mingw32-make: *** [all] Error 2
I'm stuck at this point. With another strsafe headers from msvc's folders errors in unresolved references to header files occur again and I don't know how to solve this problem. P7 documentation has instructions only about VS building. How to build the library for use in my project?

How to compile a program from .cpp files and a makefile

I recently downloaded a program. A patient specific survival prediction CLI, http://pssp.srv.ualberta.ca/
The readme included states:
"1 Compilation
The code should compile on Linux without any modification. To compile, just type ’make’. There should
be 2 executables after compilation, mtlr train and mtlr test."
I download an extracted the folder to my location, when I go into the directory and type make I get:
x#x-laptop:/pssp_source$ make
g++ -c -O3 DenseVector.cpp -o DenseVector.o
In file included from DenseVector.cpp:1:0:
DenseVector.h:9:2: error: ‘size_t’ does not name a type
size_t m_dim;
^
DenseVector.h:18:21: error: expected ‘)’ before ‘n’
DenseVector(size_t n);
^
DenseVector.h:26:33: error: ‘size_t’ does not name a type
double const& operator[](const size_t i) const
^
DenseVector.h:26:40: error: ISO C++ forbids declaration of ‘i’ with no type [-fpermissive]
double const& operator[](const size_t i) const
^
DenseVector.h:31:27: error: ‘size_t’ does not name a type
double& operator[](const size_t i)
^
DenseVector.h:31:34: error: ISO C++ forbids declaration of ‘i’ with no type [-fpermissive]
double& operator[](const size_t i)
^
DenseVector.h:38:2: error: ‘size_t’ does not name a type
size_t dim() const
^
DenseVector.h: In member function ‘void DenseVector::push_back(double)’:
DenseVector.h:23:3: error: ‘m_dim’ was not declared in this scope
m_dim++;
^
DenseVector.cpp: At global scope:
DenseVector.cpp:6:1: error: prototype for ‘DenseVector::DenseVector(size_t)’ does not match any in class ‘DenseVector’
DenseVector::DenseVector(size_t n): m_dim(n)
^
In file included from DenseVector.cpp:1:0:
DenseVector.h:5:7: error: candidates are: DenseVector::DenseVector(const DenseVector&)
class DenseVector
^
DenseVector.h:12:2: error: DenseVector::DenseVector()
DenseVector(void);
^
DenseVector.cpp: In constructor ‘DenseVector::DenseVector()’:
DenseVector.cpp:16:2: error: class ‘DenseVector’ does not have any field named ‘m_dim’
:m_dim(0)
^
DenseVector.cpp: In member function ‘void DenseVector::clear()’:
DenseVector.cpp:27:22: error: ‘m_dim’ was not declared in this scope
for (size_t i=0; i<m_dim; i++)
^
In file included from /usr/include/c++/4.8/cassert:43:0,
from DenseVector.cpp:3:
DenseVector.cpp: In function ‘double sprod_nn(const DenseVector&, const DenseVector&)’:
DenseVector.cpp:37:11: error: ‘const class DenseVector’ has no member named ‘dim’
assert(a.dim() == b.dim());
^
DenseVector.cpp:37:22: error: ‘const class DenseVector’ has no member named ‘dim’
assert(a.dim() == b.dim());
^
DenseVector.cpp:38:15: error: ‘const class DenseVector’ has no member named ‘dim’
size_t n = a.dim();
^
In file included from /usr/include/c++/4.8/cassert:43:0,
from DenseVector.cpp:3:
DenseVector.cpp: In function ‘void multadd_nn(DenseVector&, const DenseVector&, double)’:
DenseVector.cpp:49:11: error: ‘class DenseVector’ has no member named ‘dim’
assert(w.dim()==a.dim());
^
DenseVector.cpp:49:20: error: ‘const class DenseVector’ has no member named ‘dim’
assert(w.dim()==a.dim());
^
DenseVector.cpp:50:15: error: ‘class DenseVector’ has no member named ‘dim’
size_t n = w.dim();
^
DenseVector.cpp: In function ‘void smult_n(DenseVector&, double)’:
DenseVector.cpp:62:15: error: ‘class DenseVector’ has no member named ‘dim’
size_t n = w.dim();
^
make: *** [DenseVector.o] Error 1
The contents of the folder look like:
x#x-laptop:/pssp_source$ ls
common.cpp data_type_api.h DenseVector.h Main.cpp Makefile Sparm.cpp Sparm.o SparseVector.h test_model.mltr Util.h
common.h DenseVector.cpp example_data Main.o readme.pdf Sparm.h SparseVector.cpp Test.cpp test_model.mlty
I looked up the basic packages needed for compiling c++ code, as well as basics on how to run it and none have gotten me past this issue. It looks as if it has a problem with size_t not having a type.
The start of DenseVector.cpp is :
#include "DenseVector.h"
#include <cassert>
#include <iostream>
DenseVector::DenseVector(size_t n): m_dim(n)
{
m_dvector.reserve(n);
for (size_t i=0; i<n; i++)
{
m_dvector.push_back(0);
}
}
I have never compiled code like this before, so I am probably missing something obvious. If its needed I am running ubuntu 14.04, g++ version is
4.8.4.
Thanks
It sounds like the README lied. Probably it happened to work with a different version of the standard library.
Try adding
#include <stddef.h>
near the top of DenseVector.h.
Open the file DenseVector.h in the root directory of the program and modify it, inserting
#pragma once
#include <vector>
#include <cstddef> // <--- Add this line to the file
class DenseVector
{
protected:
// ...
Save it and try again!
I don't think you are using the correct version of C; I think you need C11. Instead of using the -03 flag, use -11 or -std=c11. Then recompile it.

C: Math.h has different exception specifiers

I am trying to compile my own code using some functions in this library: tsnnls
This libraries also uses other libraries: Lapack, Blas, Argtable2, TAUCS
It seems that there are some incompatiablity in error handling of function between math.h and taucs.h. Please help me in sorting out these error.
Here are error messages:
$ sudo make
g++ -c tsnnls_test_DKU.c
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:201:74: error: declaration of ‘int isinf(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,isinf,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:814:12: error: from previous declaration ‘int isinf(double)’
extern int isinf(double);
^
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:204:75: error: declaration of ‘int finite(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,finite,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:811:12: error: from previous declaration ‘int finite(double)’
extern int finite(double);
^
In file included from /usr/include/math.h:69:0,
from tsnnls_test_DKU.c:96:
/usr/include/x86_64-linux-gnu/bits/mathcalls.h:234:74: error: declaration of ‘int isnan(double) throw ()’ has a different exception specifier
__MATHDECL_1 (int,isnan,, (_Mdouble_ __value)) __attribute__ ((__const__));
^
In file included from tsnnls.h:31:0,
from tsnnls_test_DKU.c:57:
taucs_basic/taucs.h:808:12: error: from previous declaration ‘int isnan(double)’
extern int isnan(double);
^
tsnnls_test_DKU.c: In function ‘int main(int, char**)’:
tsnnls_test_DKU.c:442:46: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
colvector_write_mat(outfile,xvals,Acols,"x");
^
make: *** [tsnnls_test_DKU.o] Error 1

Compiling C++ for Python using Swig

I have successfully generated the .py and .cpp files needed using:
swig -c++ -python sf_c_api.i
but now I'm trying to make the shared object (.so) and I'm getting swamped with errors.
g++ -Wall -g -fPIC -I/usr/include/python2.6 -c atob.c fish.c maby_swap.c pwd_file.c pwd.c setup_fish.c shs.c sf_c_api.cpp sha1.cpp sf_c_api_wrap.cpp
Can anyone make heads or tails of this g++ output?
In file included from /usr/include/python2.6/Python.h:8,
from sf_c_api_wrap.cpp:149:
/usr/include/python2.6/pyconfig.h:1038:1: warning: "_XOPEN_SOURCE" redefined
<built-in>: warning: this is the location of the previous definition
In file included from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/postypes.h:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/string:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/stdexcept:39,
from sf_c_api_wrap.cpp:3024:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:143: error: ‘::btowc’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:148: error: ‘::fwide’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:149: error: ‘::fwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:150: error: ‘::fwscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:153: error: ‘::mbrlen’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:154: error: ‘::mbrtowc’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:155: error: ‘::mbsinit’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:156: error: ‘::mbsrtowcs’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:159: error: ‘::swprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:160: error: ‘::swscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:162: error: ‘::vfwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:166: error: ‘::vswprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:170: error: ‘::vwprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:174: error: ‘::wcrtomb’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:185: error: ‘::wcsrtombs’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:195: error: ‘::wctob’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:196: error: ‘::wmemcmp’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:197: error: ‘::wmemcpy’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:198: error: ‘::wmemmove’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:199: error: ‘::wmemset’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:200: error: ‘::wprintf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:201: error: ‘::wscanf’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:205: error: ‘::wcsstr’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:206: error: ‘::wmemchr’ has not been declared
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar: In function ‘wchar_t* std::wcsstr(wchar_t*, const wchar_t*)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:223: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:223: error: initializing argument 1 of ‘wchar_t* std::wcsstr(wchar_t*, const wchar_t*)’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar: In function ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:227: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/cwchar:227: error: initializing argument 1 of ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’
In file included from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/string:42,
from /usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/stdexcept:39,
from sf_c_api_wrap.cpp:3024:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static int std::char_traits<wchar_t>::compare(const wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:330: error: ‘wmemcmp’ was not declared in this scope/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static const wchar_t* std::char_traits<wchar_t>::find(const wchar_t*, size_t, const wchar_t&)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:338: error: initializing argument 1 of ‘wchar_t* std::wmemchr(wchar_t*, wchar_t, size_t)’
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::move(wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:342: error: ‘wmemmove’ was not declared in this scope
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::copy(wchar_t*, const wchar_t*, size_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:346: error: ‘wmemcpy’ was not declared in this scope
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h: In static member function ‘static wchar_t* std::char_traits<wchar_t>::assign(wchar_t*, size_t, wchar_t)’:
/usr/gcc/4.4/lib/gcc/i386-pc-solaris2.11/4.4.4/../../../../include/c++/4.4.4/bits/char_traits.h:350: error: ‘wmemset’ was not declared in this scope
/../include/c++/4.4.4/bits/char_traits.h:338: error: invalid conversion from ‘const wchar_t*’ to ‘wchar_t*’
I found a solution.
The problem is that under solaris:
If -D_XOPEN_SOURCE_EXTENDED=1, g++ cannot compile even an empty body
that #includes <iostream>. If it's undefined, then gcc cannot compile
C code.
[source]
and from /usr/include/python2.6/pyconfig.h:
/* Define to activate Unix95-and-earlier features */
#define _XOPEN_SOURCE_EXTENDED 1
Removing the XOPEN definitions fixed my problem.

Compiling C++ Thrift code to interface Cassandra results in following errors. What are we missing here?

$ g++ -lthrift -Wall thriftfs.cpp cassandra_constants.cpp Cassandra.cpp cassandra_types.cpp -o thriftfs -I/usr/local/include/thrift -L/usr/local/lib
In file included from /usr/local/include/thrift/protocol/TProtocol.h:23:0,
from /usr/local/include/thrift/TProcessor.h:24,
from Cassandra.h:10,
from t`enter code here`hriftfs.cpp:4:
/usr/local/include/thrift/transport/TTransport.h:34:1: error: ‘uint32_t’ does not name a type
/usr/local/include/thrift/transport/TTransport.h:156:29: error: ISO C++ forbids declaration of ‘buf’ with no type [-fpermissive]
In file included from /usr/local/include/thrift/TProcessor.h:24:0,
from Cassandra.h:10,
from thriftfs.cpp:4:
/usr/local/include/thrift/protocol/TProtocol.h:184:1: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:10:0,
from thriftfs.cpp:4:
/usr/local/include/thrift/TProcessor.h:72:57: error: ‘uint32_t’ has not been declared
In file included from cassandra_types.h:11:0,
from Cassandra.h:11,
from thriftfs.cpp:4:
/usr/local/include/thrift/TApplicationException.h:94:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:85:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:142:3: error: ‘uint32_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1478:16: error: ‘uint8_t’ does not name a type
In file included from Cassandra.h:11:0,
from thriftfs.cpp:4:
cassandra_types.h:1812:3: error: ‘uint32_t’ does not name a type
In file included from thriftfs.cpp:4:0:
Cassandra.h:217:3: error: ‘uint32_t’ does not name a type
Cassandra.h:4857:35: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4857:62: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4859:71: error: cannot declare pointer to ‘void’ member
Cassandra.h:4859:145: error: template argument 2 is invalid
Cassandra.h:4859:145: error: template argument 4 is invalid
Cassandra.h:4860:45: error: ‘org::apache::thrift’ has not been declared
Cassandra.h:4860:72: error: expected ‘,’ or ‘...’ before ‘*’ token
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:42: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:42: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:77: error: template argument 1 is invalid
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:105: error: ‘thrift’ is not a member of ‘org::apache’
Cassandra.h:4935:105: note: suggested alternative:
/usr/local/include/thrift/Thrift.h:75:37: note: ‘apache::thrift’
Cassandra.h:4935:140: error: template argument 1 is invalid
Cassandra.h: In constructor ‘org::apache::cassandra::CassandraProcessor::CassandraProcessor(boost::shared_ptr)’:
Cassandra.h:4898:49: error: assignment of read-only location ‘"login"[((org::apache::cassandra::CassandraProcessor*)this)->org::apache::cassandra::CassandraProcessor::processMap_]’
Cassandra.h:4898:49: error: cannot convert ‘void (org::apache::cassandra::CassandraProcessor::*)(int32_t, int) {aka void (org::apach
Add the following defines:
g++ -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H ...
Or add #include <stdint.h> before including Thrift.h in your code.
See the discussion at THRIFT-1326. The issue is suppposedly fixed in thrift 0.9.
It looks like your problem is a compiler issue.
It can't find the type "uint32_t"
There is another question on SO regarding this:
'uint32_t' identifier not found error
Quoted from user templatetypedef
This type is defined in the C header which is not currently
a part of the C++ standard. According to the Wikipedia page on the
header, it hasn't shipped with Visual Studio until VS2010.
In the meantime, you could probably fake up your own version of the
header by adding typedefs that map Microsoft's custom integer types to
the types expected by C. For example:
typedef __int32 int32_t; typedef unsigned __int32 uint32_t; /* ...
etc. ... */ Hope this helps!