Language version: Microsoft Visual C++ 2013 Redistributable (x85) – 12.0.30501
Platform version: 4.0
Operating system: Microsoft Windows 8.1 6.3.9600 Build 9600
Any other relevant software:
Visual Studio 2013 Community with update 4
Halo Configuration Control Panel
Halo Hub
What I am trying to do
I am trying to communicate with a peripheral device that is using the OSDP protocol.
What is actually happening
I get the following from the output panel in visual studio.
Received valid packet of 326 bytes
Received authentication response from OSDP Hub
Session Key > E856417D8B0364313A4B8F0D89524273F0F70AB1DFF8E950FE96905FECAC9F2F
Received packet after 3 ms
Received valid packet of 4 bytes
Received authentication denial from OSDP Hub
Received packet after 0 ms
Performing a search on 0 devices
Rough Copy
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Work\velox\admins-velox-project\proprietary\rtos\apps\chibios\utilities\osdp_client\Debug_msvc\osdp_client_mswud_vc11.exe'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded
'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded
'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\comdlg32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winspool.drv'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.9600.18006_none_a9ec6aab013aafee\comctl32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wsock32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmmbase.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\combase.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\SHCore.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\ProgramData\Internet Helper Anti-phishing\internetHelper_antiphishing.dll'. Module was built without symbols.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\IconCodecService.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\WindowsCodecs.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.9600.18696_none_dae05f525bc50fb1\GdiPlus.dll'. Cannot find or open the PDB file.
Password = 1234
Private key = 03ac674216f3e15c761ee1a5e255f067
Added 0 items
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mswsock.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dnsapi.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\FWPUCLNT.DLL'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rasadhlp.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptsp.dll'. Symbols loaded.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rsaenh.dll'. Cannot find or open the PDB file.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcrypt.dll'. Symbols loaded.
..\..\src\common\strvararg.cpp(658): assert "n <= parser.nargs" failed in `anonymous-namespace'::DoGetArgumentType(): more arguments than format string specifiers? [in thread cb4]
First-chance exception at 0x76165608 (KernelBase.dll) in osdp_client_mswud_vc11.exe: 0x00001976.
'osdp_client_mswud_vc11.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dbghelp.dll'. Symbols loaded.
DBGHELP: Symbol Search Path: .
DBGHELP: .\wkernelbase.pdb - file not found
DBGHELP: .\dll\wkernelbase.pdb - file not found
DBGHELP: .\symbols\dll\wkernelbase.pdb - file not found
DBGHELP: wkernelbase.pdb - file not found
DBGHELP: KERNELBASE - export symbols
DBGHELP: .\osdp_client_mswud_vc11.pdb - file not found
DBGHELP: .\exe\osdp_client_mswud_vc11.pdb - file not found
DBGHELP: .\symbols\exe\osdp_client_mswud_vc11.pdb - file not found
Received valid packet of 326 bytes
Received authentication response from OSDP Hub
Session Key > 63B2D0C583090EFD994B5AFE12A417A07F406CEE1F64DCB1613703B45428E32E
Received packet after 3 ms
Received valid packet of 4 bytes
Received authentication denial from OSDP Hub
Received packet after 2 ms
DBGHELP: osdp_client_mswud_vc11 - private symbols & lines
C:\Work\velox\admins-velox-project\proprietary\rtos\apps\chibios\utilities\osdp_client\Debug_msvc\osdp_client_mswud_vc11.pdb
DBGHELP: .\msvcr120d.i386.pdb - file not found
DBGHELP: .\dll\msvcr120d.i386.pdb - file not found
DBGHELP: .\symbols\dll\msvcr120d.i386.pdb - file not found
DBGHELP: msvcr120d.i386.pdb - file not found
DBGHELP: MSVCR120D - export symbols
DBGHELP: .\wntdll.pdb - file not found
DBGHELP: .\dll\wntdll.pdb - file not found
DBGHELP: .\symbols\dll\wntdll.pdb - file not found
DBGHELP: wntdll.pdb - file not found
DBGHELP: ntdll - export symbols
DBGHELP: .\wkernel32.pdb - file not found
DBGHELP: .\DLL\wkernel32.pdb - file not found
DBGHELP: .\symbols\DLL\wkernel32.pdb - file not found
DBGHELP: wkernel32.pdb - file not found
DBGHELP: KERNEL32 - export symbols
Here is the actual code;
case OSDP_HUB:
{
bool ipv4;
uint8_t ip_addr[16];
osdp_hub_messages* hub = (osdp_hub_messages*)m_packets.get_data( OSDP_HUB );
// goes from here to decode method ondown
hub->decode( (uint8_t*)buffer, m_packets.get_header()->m_data.length );
if ( hub->get_msg_type() == OSDP_HUB_TCP_IND )
{
hub->get_ip_addr( &ipv4, ip_addr );
if ( hub->get_enable() )
{
// Device has connected...
wxLogDebug( wxT("Device connected on IP address %d.%d.%d.%d : %u"),
ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3], hub->get_tcp_port() );
m_tcp_device_connected = true;
// Assign an address
/// #todo Create an address generation function
std::vector<uint8_t> ip_addr_vec;
ip_addr_vec.resize( ipv4? 4 : 16 );
memcpy( &ip_addr_vec[0], ip_addr, ipv4? 4 : 16 );
m_tcp_map[0] = ip_addr_vec;
MyCustomEvent customEvent( MyCustomCommandEvent, ID_EVENT_TCP_ADD );
customEvent.SetText( _T( "SocketThread::Entry() ID_EVENT_TCP_ADD" ) );
wxPostEvent( m_parent, customEvent );
}
else
{
// Device has disconnected...
wxLogDebug( wxT("Device disconnected on IP address %d.%d.%d.%d"),
ip_addr[0], ip_addr[1], ip_addr[2], ip_addr[3] );
// Change the UI to display the nearest device on the list
MyCustomEvent customEvent( MyCustomCommandEvent, ID_EVENT_TCP_REMOVE );
customEvent.SetText( _T( "SocketThread::Entry() ID_EVENT_TCP_REMOVE" ) );
wxPostEvent( m_parent, customEvent );
}
}
else if ( hub->get_msg_type() == OSDP_HUB_AUTH_1 )
{
wxLogDebug( wxT("Received authentication response from OSDP Hub") );
m_auth1_received = true;
std::string salt = hub->get_salt();
std::string key = hub->get_publickey();
m_srp_auth->gen_client_session_key( salt, key );
wxLogDebug( wxT("Session Key > %s"), m_srp_auth->get_session_key() );
m_srp_auth->gen_client_cryptogram();
}
else if ( hub->get_msg_type() == OSDP_HUB_AUTH_3 ) // skips here
{
wxLogDebug( wxT("Received authentication accept from OSDP Hub") );
m_auth3_received = true;
}
else if ( hub->get_msg_type() == OSDP_HUB_AUTH_4 ) // enters in here
{
wxLogDebug( wxT("Received authentication denial from OSDP Hub") );
m_auth4_received = true;
}
else if ( hub->get_msg_type() == OSDP_HUB_PONG )
{
wxLogDebug( wxT("Received PONG from OSDP Hub") );
m_pong_received = true;
int32_t length;
hub->encode( (uint8_t*)msg, &length );
m_clientSocket->Write( (char*)msg, length );
}
} break;
//comes in here
int32_t osdp_hub_messages::decode( uint8_t* buffer, int32_t len )
{
return osdp_hub_messages_decode( &m_osdp_hub_messages, buffer, len );
} // decode()
// then comes in here
int32_t osdp_hub_messages_decode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t len )
{
//goes from OSDP_HUB_AUTH_2 t0 OSDP_HUB_AUTH_4
//never hits OSDP_HUB_START or OSDP_HUB_TCP_IND
data->hub_msg = (osdp_hub_e)buffer[0];
switch ( data->hub_msg )
{
case OSDP_HUB_START: return decode_start( data, buffer+1, len ); break;
case OSDP_HUB_TCP_IND: return decode_tcp_ind( data, buffer+1, len ); break;
case OSDP_HUB_AUTH_0: return decode_auth_0( data, buffer+1, len ); break;
case OSDP_HUB_AUTH_1: return decode_auth_1( data, buffer+1, len ); break;
case OSDP_HUB_AUTH_2: return decode_auth_2( data, buffer+1, len ); break;
case OSDP_HUB_AUTH_3: return decode_auth_2( data, buffer+1, len ); break;
case OSDP_HUB_AUTH_4: return decode_auth_4( data, buffer+1, len ); break;
case OSDP_HUB_PING: return decode_ping( data, buffer+1, len ); break;
case OSDP_HUB_PONG: return decode_pong( data, buffer+1, len ); break;
case OSDP_HUB_GET_AUTH_1: return decode_get_auth_1( data, buffer+1, len ); break;
case OSDP_HUB_GET_AUTH_3: return decode_get_auth_3( data, buffer+1, len ); break;
default:
{
return 0;
} break;
}
} // osdp_hub_messages_decode()
//additional code
/// #file osdp_halo_alarm_base.h
/// #brief A C implementation of the proprietary Halo alarm packet.
///
/// #author neil
#pragma once
#include "osdp_header.h"
#ifdef _cplusplus
extern "C" {
#endif
/// The ID used to define a HALO HUB packet
#define OSDP_HUB 0x00
typedef enum
{
OSDP_HUB_START = 0,
OSDP_HUB_TCP_IND,
OSDP_HUB_AUTH_0,
OSDP_HUB_AUTH_1,
OSDP_HUB_AUTH_2,
OSDP_HUB_AUTH_3,
OSDP_HUB_AUTH_4,
OSDP_HUB_PING,
OSDP_HUB_PONG,
OSDP_HUB_GET_AUTH_1,
OSDP_HUB_GET_AUTH_3,
} osdp_hub_e;
struct _osdp_hub_messages_t
{
osdp_hub_e hub_msg;
bool enable;
uint8_t max_tcp;
uint8_t ip_addr[16];
bool ipv4;
uint32_t port;
bool success;
uint8_t username[17];
uint8_t publickey[321];
uint8_t salt[65];
uint8_t cryptogram[65];
osdp_header_t* header;
};
typedef struct _osdp_hub_messages_t osdp_hub_messages_t;
/// #brief Translate the data structure to a packet for transmission
/// #param buffer An input data buffer used to store the packet
/// #param len The length of the output packet
void osdp_hub_messages_encode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t* len );
/// #brief Translate a received packet into a data structure
/// #param data A struct containing the decoded output parameters
/// #param buffer An input data buffer used to store the packet
/// #param len The length of the input packet
/// #return The number of decoded bytes
int32_t osdp_hub_messages_decode( osdp_hub_messages_t* data, uint8_t* buffer, int32_t len );
#ifdef _cplusplus
}
#endif
//
// end of file
//
Anymore information required and i will surely add it. Thanks for your help!
The code you posted does not look like SIA OSDP. (According to Sensurity's web site that is the OSDP they are referring to.) Perhaps this is some other part of the mechanism? The current SIA OSDP working group activity regarding OSDP over an IP network is around OSDP over TCP (using the existing "secure channel" mechanism) or OSDP over TLS.
Related
I am new to visual studio, I am trying to run a sample CPP code from a company which connects to DCAM API application. I have checked the version of VS in .sln file and installed that version of VS.I tried running the code below
// console/init_uninit
//
#include "../misc/console4.h"
#include "../misc/common.h"
#define USE_INITOPTION 0 // set DCAMAPI_INITOPTION when the value isn't 0.
#define USE_INITGUID 0 // set GUID parameter when the value isn't 0.
#if USE_INITGUID
#include "../misc/dcamapix.h"
#endif
int main( int argc, char* const argv[] )
{
printf( "PROGRAM START\n" );
int ret = 0;
DCAMERR err;
// initialize DCAM-API
DCAMAPI_INIT apiinit;
memset( &apiinit, 0, sizeof(apiinit) );
apiinit.size = sizeof(apiinit);
#if USE_INITOPTION
// set option of initialization
int32 initoption[] = {
DCAMAPI_INITOPTION_APIVER__LATEST,
DCAMAPI_INITOPTION_ENDMARK // it is necessary to set as the last value.
};
apiinit.initoption = initoption;
apiinit.initoptionbytes = sizeof(initoption);
#endif
#if USE_INITGUID
// set GUID parameter
DCAM_GUID guid = DCAM_GUID_MYAPP;
apiinit.guid = &guid;
#endif
err = dcamapi_init( &apiinit );
if( failed(err) )
{
dcamcon_show_dcamerr( NULL, err, "dcamapi_init()" );
ret = 1;
}
else
{
int32 nDevice = apiinit.iDeviceCount;
printf( "dcamapi_init() found %d device(s).\n", nDevice );
int32 iDevice;
for( iDevice = 0; iDevice < nDevice; iDevice++ )
{
dcamcon_show_dcamdev_info( (HDCAM)(intptr_t)iDevice );
}
}
// finalize DCAM-API
dcamapi_uninit(); // recommended call dcamapi_uninit() when dcamapi_init() is called even if it failed.
printf( "PROGRAM END\n" );
return ret;
}
While Running the above code I am Getting the bellow output. But the application couldn't run.
'init_uninit.exe' (Win32): Loaded 'C:\Users\bbbra\camera software\Hamamatsu_DCAMSDK4_v20086083\dcamsdk4\samples\cpp\init_uninit\x64\Debug\init_uninit.exe'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\dcamapi.dll'. Module was built without symbols.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\dcamapi.dll'
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\dcamapi.dll'. Module was built without symbols.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\setupapi.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\msvcrt.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\cfgmgr32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbase.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\rpcrt4.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\bcrypt.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\user32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\win32u.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\gdi32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\gdi32full.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\msvcp_win.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\advapi32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\sechost.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\shell32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\ole32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\combase.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\oleaut32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\psapi.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\shlwapi.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\version.dll'. Symbols loaded.
'C:\Windows\System32\imm32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\dcamdig.dll'. Module was built without symbols.
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\dcamdig.dll'
'init_uninit.exe' (Win32): Loaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\dcamdig.dll'. Module was built without symbols.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\winmm.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\fg1394oh.dll'. Module was built without symbols.
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\fg1394oh.dll'
'init_uninit.exe' (Win32): Loaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\fg1394oh.dll'. Module was built
without symbols.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\hps1394.dll'. Module
was built without symbols.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\comdlg32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\SHCore.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\msimg32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded
'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.488_none_4238de57f6b64d28\comctl32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\winspool.drv'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded
'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.488_none_4238de57f6b64d28\comctl32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.488_none_4238de57f6b64d28\comctl32.dll'
'init_uninit.exe' (Win32): Loaded
'C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.746_none_faeda79b76159a72\GdiPlus.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\oleacc.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\uxtheme.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\dwmapi.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\kernel.appcore.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\bcryptprimitives.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\clbcatq.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\devenum.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\ntmarta.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\devobj.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\wintrust.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\crypt32.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\msasn1.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Loaded 'C:\Windows\System32\msdmo.dll'. Symbols loaded.
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\devenum.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\uxtheme.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\dwmapi.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\msimg32.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\SHCore.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\comdlg32.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\winspool.drv'
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\WinSxS\amd64_microsoft.windows.common-controls_6595b64144ccf1df_5.82.19041.488_none_4238de57f6b64d28\comctl32.dll'
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.746_none_faeda79b76159a72\GdiPlus.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\oleacc.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\hps1394.dll'
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\fg1394oh.dll'
'init_uninit.exe' (Win32): Unloaded 'C:\Windows\System32\winmm.dll'
'init_uninit.exe' (Win32): Unloaded
'C:\Windows\System32\DCAMAPI\Modules\Digital\dcamdig.dll'
The thread 0x3060 has exited with code 1 (0x1).
The thread 0x1ac has exited with code 1 (0x1).
The thread 0x1280 has exited with code 1 (0x1).
The program '[4456] init_uninit.exe' has exited with code 1 (0x1).
Please suggest me where I went wrong.
Set the frame grabber in different slot and try. If the problem still persists then go to >Device Manager and check for a folder named >Imaging devices. If you cant see that folder that means the camera is dead or not connected.
OR you can try to do "Scan for hardware changes" in >Action tap on top of the page.
Make sure to press >Retarget Solution Before rebuilding it in the visual studio.
I'm starting to program and I'm using Visual Studio. I have this simple program that some days ago worked, but after working with another project, it returns me an error:
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <math.h>
int main() {
double a = 3;
FILE *A;
scanf("%lf", &a);
A = fopen("B:\\Mis Documentos\\Coding\\Test 200.txt", "wt");
fprintf(A, "Hello World, I have %lf", a);
fclose(A);
}
But I can't compile it, it returns me this error. This is the log:
'Project1.exe' (Win32): Loaded 'B:\Mis Documentos\Documents\Visual Studio 2015\Projects\Project1\Debug\Project1.exe'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\ntdll.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\kernel32.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\KernelBase.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\vcruntime140d.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\ucrtbased.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-timezone-l1-1-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l2-1-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-localization-l1-2-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-synch-l1-2-0.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-processthreads-l1-1-1.dll'. Symbols loaded.
'Project1.exe' (Win32): Loaded 'C:\Windows\System32\api-ms-win-core-file-l1-2-0.dll'. Symbols loaded.
Debug Assertion Failed!
Program: ...ments\Visual Studio 2015\Projects\Project1\Debug\Project1.exe
File: minkernel\crts\ucrt\src\appcrt\stdio\output.cpp
Line: 31
Expression: stream != nullptr
For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
You're not checking if the file was actually opened. You should check if file was actually opened after calling fopen
FILE *A = NULL;
....
A = fopen("B:\\Mis Documentos\\Coding\\Test 200.txt", "wt");
//Check if file was actually opened
if(A) {
....
}
Check documentation on this function, for example here. You should also initialize A variable, it's a good practice.
At the end it was my fault, I didn't create the folder "Coding" where I wanted the file. I can finish what I wanted to do now, but I saw that if I want to create the file in my Google Drive folder, sometimes works an others don't. Not sure why, maybe because it's connected to internet?
Anyway, thanks a lot for your fast help!
After installing Visual Studio 2013 Express on my Windows 7 64-bit PC, I tested the following simple Hello World C++ program:
1 #include <iostream>
2 using namespace std;
3
4 int main() {
5 cout << "Hello World" << endl;
6 return 0;
7 }
When I run this code in normal execution (using ctr+F5), the programs runs fine. However, when I run it with the debugger (using F5 only), I get the following message box that appears :
"First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued."
I press continue and then another message box appear saying :
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
If there is a handler for this exception, the program may be safely continued.
I press continue again and the console output is the following :
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Users\212426625\Desktop\ConsoleApplication1\Debug\ConsoleApplication1.exe'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\DgApi.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\psapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ws2_32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nsi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\mpr.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shell32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\shlwapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr120d.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AE_MailSensor_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_OutlookSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\09D849B6-32D3-4A40-85EE-6B84BA29E35B\AME_SmtpSensor.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\OS_Plugin.dll'. Cannot find or open the PDB file.
'ConsoleApplication1.exe' (Win32): Loaded 'C:\Program Files\DGAgent\plugins\8E4EA70A-6128-4B57-BD3F-8E9E0F0DA6BB\COM_Sensor.dll'. Cannot find or open the PDB file.
The thread 0x1f34 has exited with code 0 (0x0).
First-chance exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
Unhandled exception at 0x778412C7 in ConsoleApplication1.exe: 0xC0000008: An invalid handle was specified.
The program '[1836] ConsoleApplication1.exe' has exited with code 0 (0x0).
So I tried to figure out what's going on by putting a break point at line #5 and stepping with F10. I can step passed the closing bracket of the main() and then enter in a file called "crtexe.c" (see code block below). I continue stepping through this file until the exception pops up at line #649:
645 #else /* !defined (_WINMAIN_) && defined (_CRT_APP) */
646 if ( !managedapp )
647 {
648 #ifndef _CRT_APP
649 exit(mainret);
650 #else
What is the explanation for this behavior and how can I get it to work as expected?
Edit:
The stack trace is as follow (Since I can't post pictures, I wrote it down):
Call Stack
Name Language
ntdll.dll!ZwClose#4() Unknown
KernelBase.dll!_CloseHandle#4() Unknown
kernel32.dll!_CloseHandleImplementation#4() Unknown
AME_OutlookSensor.dll!732cc94d() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for AME_OutlookSensor.dll]
AME_OutlookSensor.dll!732b91bc() Unknown
AME_OutlookSensor.dll!732b928f() Unknown
AME_OutlookSensor.dll!732b44c4() Unknown
AME_OutlookSensor.dll!732b461f() Unknown
AME_OutlookSensor.dll!732b468a() Unknown
[External Code]
I've recently started using the Library SFML with visual studios 2012 c++.
It all worked fine until i started to use custom fonts, and then these messages popped up and nothing worked:
'Graphics test.exe' (Win32): Loaded 'C:\Users\Oliver Bolt\Documents\Visual Studio 2012\Projects\Graphics test\Debug\Graphics test.exe'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvinit.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\_etoured.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\Nvd3d9wrap.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Program Files (x86)\NVIDIA Corporation\coprocmanager\nvdxgiwrap.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\PROGRA~2\OPTIMI~1\OPTPRO~1.DLL'. Module was built without symbols.
'Graphics test.exe' (Win32): Unloaded 'C:\PROGRA~2\OPTIMI~1\OPTPRO~1.DLL'
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig7icd32.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\igdusc32.dll'. Cannot find or open the PDB file.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dinput.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\hid.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\wintrust.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\crypt32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msasn1.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Symbols loaded.
'Graphics test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
The thread 0xed8 has exited with code 0 (0x0).
The thread 0x131c has exited with code 0 (0x0).
The thread 0x105c has exited with code 0 (0x0).
The thread 0x19e8 has exited with code 0 (0x0).
The thread 0xeb4 has exited with code 0 (0x0).
The thread 0x187c has exited with code 0 (0x0).
The thread 0x1c78 has exited with code 0 (0x0).
The thread 0x480 has exited with code 0 (0x0).
The thread 0x1244 has exited with code 0 (0x0).
The program '[4124] Graphics test.exe' has exited with code 0 (0x0).
The program that caused these errors:
#include <SFML\System.hpp>
#include <SFML\Graphics.hpp>
#include <ctime>
#include <sstream>
using namespace sf;
using namespace std;
int main()
{
VideoMode videoMode(320, 240);
RenderWindow window(videoMode, "Plus or minus");
Font font;
if (!font.loadFromFile("TOMB.TTF"))
{
return EXIT_FAILURE;
}
Text title("Plus Or Minus", font, 20);
title.setPosition(10, 10);
title.setColor(Color::White);
Text question("What is your guess ?",font,20);
question.setPosition(5,30);
question.setColor(Color::White);
Text enter("", font, 20);
enter.setPosition(5, 50);
enter.setColor(Color::Green);
String textEntered;
int numEntered = 0;
Text status("", font, 16);
status.setPosition(100, 50);
status.setColor(Color::Yellow);
stringstream out("");
Text won("You have discovered\n the secret number\n in less than 10 tries,\n well played !", font, 20);
won.setPosition(5, 70);
won.setColor(Color::Green);
Text lost("You have failed to\n discover the secret\n number in less than\n 10 tries, better \nluck next time!", font, 20);
lost.setPosition(5, 70);
lost.setColor(Color::Red);
srand(static_cast<unsigned int> (time(NULL)));
int secretNumber = rand() % 100;
bool isGameOn = true;
bool playerWon = false;
int tryNumber = 0;
while (window.isOpen())
{
window.clear();
window.draw(title);
if (isGameOn)
{
window.draw(question);
window.draw(enter);
window.draw(status);
}
else
{
if (playerWon)
{
window.draw(won);
}
else
{
window.draw(lost);
}
}
window.display();
Event event;
while (window.pollEvent(event))
{
if ((event.type == Event::Closed) || ((event.type == Event::KeyPressed) && (event.key.code == Keyboard::Escape)))
{
window.close();
}
if (event.type == Event::TextEntered)
{
char c = static_cast<char> (event.text.unicode);
if (c >= '0' && c <= '9')
{
textEntered += event.text.unicode;
enter.setString(textEntered);
}
else if (c == '\r')
{
tryNumber++;
stringstream in(enter.getString());
in >> numEntered;
if (numEntered > secretNumber)
{
out << tryNumber;
out << ". ";
out << numEntered;
out << ": Minus" << endl;
status.setString(out.str());
}
if (numEntered < secretNumber)
{
out << tryNumber;
out << ". ";
out << numEntered;
out << ": Plus" << endl;
status.setString(out.str());
}
if (numEntered == secretNumber)
{
playerWon = true;
status.setString("");
isGameOn = false;
}
if (tryNumber > 10)
{
playerWon = false;
status.setString("");
isGameOn = false;
}
textEntered = "";
}
}
}
return EXIT_SUCCESS;
}
}
I have searched around, but i didn't really find an answer to this problem, would be really grateful if someone could help me solve this! :)
Best Regards
FreeSirenety
You have a return statement at the end of your while (window.isOpen()) { ... } loop.
So the loop runs only once.
I'm fairly new to Visual studios and C++ as well. I've been trying to get the Sierpinski Gasket example from Interactive Computer Graphics A Top-Down Approach with OpenGL by Ed Angels, specifically the Chapter 2 Example 1 Visual C++ Project, and I've ran into to some problems that I can't seem to solve or find a solution to. The problem I have is when I run it in VS2012 the window immediately closes with error something along the lines of it couldn't find vshader21.glsl. When I run it from the 6E Test.exe in the debug folder it opens fine, creates a window but it doesn't show any of the triangles, just a blank white box. I have downloaded the latest versions of GLEW and freeglut and I'm positive I put everything in the right place.
The example project includes: Angel.h, vec.h, mat.h, CheckError.h, example1.cpp, InitShader.cpp, vshader21.glsl, and fshader21.glsl
I believe the error is coming from the example1.cpp with the line GLuint program = InitShader( "vshader21.glsl", "fshader21.glsl" ); not finding the files ut i have added both the .glsl to the debug folder and changed the path to go to the debug folder in the Working Directory of the project properties. Any Suggestions or solutions as to how i can fix this?
#include "Angel.h"
const int NumPoints = 5000;
void
init( void )
{
vec2 points[NumPoints];
// Specifiy the vertices for a triangle
vec2 vertices[3] = {
vec2( -1.0, -1.0 ), vec2( 0.0, 1.0 ), vec2( 1.0, -1.0 )
};
// Select an arbitrary initial point inside of the triangle
points[0] = vec2( 0.25, 0.50 );
// compute and store N-1 new points
for ( int i = 1; i < NumPoints; ++i ) {
int j = rand() % 3; // pick a vertex at random
// Compute the point halfway between the selected vertex
// and the previous point
points[i] = ( points[i - 1] + vertices[j] ) / 2.0;
}
// Create a vertex array object
GLuint vao;
glGenVertexArrays( 1, &vao );
glBindVertexArray( vao );
// Create and initialize a buffer object
GLuint buffer;
glGenBuffers( 1, &buffer );
glBindBuffer( GL_ARRAY_BUFFER, buffer );
glBufferData( GL_ARRAY_BUFFER, sizeof(points), points, GL_STATIC_DRAW );
// Load shaders and use the resulting shader program
GLuint program = InitShader( "vshader21.glsl", "fshader21.glsl" );
glUseProgram( program );
// Initialize the vertex position attribute from the vertex shader
GLuint loc = glGetAttribLocation( program, "vPosition" );
glEnableVertexAttribArray( loc );
glVertexAttribPointer( loc, 2, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
glClearColor( 1.0, 1.0, 1.0, 1.0 ); // white background
}
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT ); // clear the window
glDrawArrays( GL_POINTS, 0, NumPoints ); // draw the points
glFlush();
}
void
keyboard( unsigned char key, int x, int y )
{
switch ( key ) {
case 033:
exit( EXIT_SUCCESS );
break;
}
}
int
main( int argc, char **argv )
{
glutInit(&argc, argv);
glutInitDisplayMode( GLUT_RGBA );
glutInitWindowSize( 512, 512 );
// If you are using freeglut, the next two lines will check if
// the code is truly 3.2. Otherwise, comment them out
glutInitContextVersion( 3, 1 );
glutInitContextProfile( GLUT_CORE_PROFILE );
glutCreateWindow( "Sierpinski Gasket" );
glewInit();
init();
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutMainLoop();
return 0;
}
UPDATE this is what it tells me when I press F5 to run it.
my version of GLEW is 1.10.0 and freeglut is 2.8.1-1
'6E test.exe' (Win32): Loaded 'C:\Users\Robert\Documents\6E test\Debug\6E test.exe'. Symbols loaded.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Users\Robert\Documents\6E test\Debug\freeglut.dll'. Module was built without symbols.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\user32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\gdi32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\lpk.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\usp10.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\opengl32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\glu32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ddraw.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dciman32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\setupapi.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cfgmgr32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\oleaut32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\devobj.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\dwmapi.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\winmm.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Users\Robert\Documents\6E test\Debug\glew32.dll'. Module was built without symbols.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp110d.dll'. Symbols loaded.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcr110d.dll'. Symbols loaded.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\imm32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msctf.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\nvinit.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\uxtheme.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ig7icd32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\version.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\version.dll'
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ole32.dll'. Cannot find or open the PDB file.
'6E test.exe' (Win32): Unloaded 'C:\Windows\SysWOW64\ole32.dll'
'6E test.exe' (Win32): Loaded 'C:\Windows\SysWOW64\clbcatq.dll'. Cannot find or open the PDB file.
The program '[6244] 6E test.exe' has exited with code 1 (0x1).
You cannot use single-buffered windowed drawing in newer versions of Microsoft Windows, with Desktop Composition enabled. Even after you get your shader loading mechanism working correctly, you are going to run into a much bigger issue, where the ouput is not visible. In fact judging by your problem description I think you already are encountering this issue.
Please have a look at this question for a more detailed explanation of the problem and the solution.