Click here to Skip to main content
15,880,405 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow can put here Vertical Scrollbar and Infotip or Tooltip for Items and Subitems? [modified] Pin
Le@rner9-Jul-10 20:20
Le@rner9-Jul-10 20:20 
QuestionCannot open the Dalog(DataBase error) [modified] Pin
raju_shiva9-Jul-10 18:33
raju_shiva9-Jul-10 18:33 
AnswerRe: Cannot open the Dalog(DataBase error) Pin
Richard MacCutchan10-Jul-10 0:39
mveRichard MacCutchan10-Jul-10 0:39 
Questionunreadable text on Grid Control Pin
Max++9-Jul-10 14:54
Max++9-Jul-10 14:54 
AnswerRe: unreadable text on Grid Control Pin
Garth J Lancaster9-Jul-10 19:22
professionalGarth J Lancaster9-Jul-10 19:22 
QuestionWin32 + Direct2D Pin
Fareed Rizkalla9-Jul-10 14:33
Fareed Rizkalla9-Jul-10 14:33 
AnswerRe: Win32 + Direct2D Pin
Cedric Moonen9-Jul-10 22:02
Cedric Moonen9-Jul-10 22:02 
QuestionError in building QuickFix library in Exceptions.h Pin
arupsarkar9-Jul-10 8:54
arupsarkar9-Jul-10 8:54 
Hi
I am in the process of learning FIX protocol using QuickFix, I am following the example which is given in the documentation,however I am getting an error during build in one file which is part of the quickfix header file.

Can anyone please let me know if I am missing anything in my project configuration. Just as an FYI I did follow all the instruction in quickfix website to set up a C++ project.

Regards
Arup

Error:
---------------------
<br />
1>c:\project\quickfix\quickfix_c\quickfix\include\quickfix\exceptions.h(260) : error C2664: 'FormatMessageW' : cannot convert parameter 5 from 'char [2048]' to 'LPWSTR'<br />
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast<br />



Code of Exceptions.h. The error is in line 260 which is as follows:

<br />
#ifdef _MSC_VER<br />
    error = WSAGetLastError();<br />
    char buffer[2048];<br />
    FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,<br />
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),<br />
                   buffer, 2048, NULL );<br />
    return buffer;<br />
#else<br />


Exceptions.h
-------------------------

<br />
/* -*- C++ -*- */<br />
<br />
/****************************************************************************<br />
** Copyright (c) quickfixengine.org  All rights reserved.<br />
**<br />
** This file is part of the QuickFIX FIX Engine<br />
**<br />
** This file may be distributed under the terms of the quickfixengine.org<br />
** license as defined by quickfixengine.org and appearing in the file<br />
** LICENSE included in the packaging of this file.<br />
**<br />
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE<br />
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.<br />
**<br />
** See http://www.quickfixengine.org/LICENSE for licensing information.<br />
**<br />
** Contact ask@quickfixengine.org if any conditions of this licensing are<br />
** not clear to you.<br />
**<br />
****************************************************************************/<br />
<br />
#ifndef FIX_EXCEPTIONS_H<br />
#define FIX_EXCEPTIONS_H<br />
<br />
#include <string><br />
#include <stdexcept><br />
#include "Utility.h"<br />
<br />
namespace FIX<br />
{<br />
<br />
/// Base QuickFIX exception type.<br />
struct Exception : public std::logic_error<br />
{<br />
  Exception( const std::string& t, const std::string& d )<br />
  : std::logic_error( d.size() ? t + ": " + d : t ),<br />
    type( t ), detail( d )<br />
  {}<br />
  ~Exception() throw() {}<br />
<br />
  std::string type;<br />
  std::string detail;<br />
};<br />
<br />
/// DataDictionary not found for BeginString or ApplVerID<br />
struct DataDictionaryNotFound : public Exception<br />
{<br />
  DataDictionaryNotFound( const std::string& v, const std::string& what = "" )<br />
    : Exception( "Could not find data dictionary", what ),<br />
                 version( v ) {}<br />
  ~DataDictionaryNotFound() throw() {}<br />
<br />
  std::string version;<br />
};<br />
<br />
/// Field not found inside a message<br />
struct FieldNotFound : public Exception<br />
{<br />
  FieldNotFound( int f = 0, const std::string& what = "" )<br />
    : Exception( "Field not found", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Unable to convert field into its native format<br />
struct FieldConvertError : public Exception<br />
{<br />
  FieldConvertError( const std::string& what = "" )<br />
    : Exception( "Could not convert field", what ) {}<br />
};<br />
<br />
/// Unable to parse message<br />
struct MessageParseError : public Exception<br />
{<br />
  MessageParseError( const std::string& what = "" )<br />
    : Exception( "Could not parse message", what ) {}<br />
};<br />
<br />
/// Not a recognizable message<br />
struct InvalidMessage : public Exception<br />
{<br />
  InvalidMessage( const std::string& what = "" )<br />
    : Exception( "Invalid message", what ) {}<br />
};<br />
<br />
/// %Application is not configured correctly<br />
struct ConfigError : public Exception<br />
{<br />
  ConfigError( const std::string& what = "" )<br />
    : Exception( "Configuration failed", what ) {}<br />
};<br />
<br />
/// %Application encountered serious error during runtime<br />
struct RuntimeError : public Exception<br />
{<br />
  RuntimeError( const std::string& what = "" )<br />
    : Exception( "Runtime error", what ) {}<br />
};<br />
<br />
/// Tag number does not exist in specification<br />
struct InvalidTagNumber : public Exception<br />
{<br />
  InvalidTagNumber( int f = 0, const std::string& what = "" )<br />
    : Exception( "Invalid tag number", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Required field is not in message<br />
struct RequiredTagMissing : public Exception<br />
{<br />
  RequiredTagMissing( int f = 0, const std::string& what = "" )<br />
    : Exception( "Required tag missing", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Field does not belong to message<br />
struct TagNotDefinedForMessage : public Exception<br />
{<br />
  TagNotDefinedForMessage( int f = 0, const std::string& what = "" )<br />
    : Exception( "Tag not defined for this message type", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Field exists in message without a value<br />
struct NoTagValue : public Exception<br />
{<br />
  NoTagValue( int f = 0, const std::string& what = "" )<br />
    : Exception( "Tag specified without a value", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Field has a value that is out of range<br />
struct IncorrectTagValue : public Exception<br />
{<br />
  IncorrectTagValue( int f = 0, const std::string& what = "" )<br />
    : Exception( "Value is incorrect (out of range) for this tag", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Field has a badly formatted value<br />
struct IncorrectDataFormat : public Exception<br />
{<br />
  IncorrectDataFormat( int f = 0, const std::string& what = "" )<br />
    : Exception( "Incorrect data format for value", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Message is not structured correctly<br />
struct IncorrectMessageStructure : public Exception<br />
{<br />
  IncorrectMessageStructure( const std::string& what = "" )<br />
    : Exception( "Incorrect message structure", what ) {}<br />
};<br />
<br />
/// Field shows up twice in the message<br />
struct DuplicateFieldNumber : public Exception<br />
{<br />
  DuplicateFieldNumber( const std::string& what = "" )<br />
    : Exception( "Duplicate field number", what ) {}<br />
};<br />
<br />
/// Not a known message type<br />
struct InvalidMessageType : public Exception<br />
{<br />
  InvalidMessageType( const std::string& what = "" )<br />
    : Exception( "Invalid Message Type", what ) {}<br />
};<br />
<br />
/// Message type not supported by application<br />
struct UnsupportedMessageType : public Exception<br />
{<br />
  UnsupportedMessageType( const std::string& what = "" )<br />
    : Exception( "Unsupported Message Type", what ) {}<br />
};<br />
<br />
/// Version of %FIX is not supported<br />
struct UnsupportedVersion : public Exception<br />
{<br />
  UnsupportedVersion( const std::string& what = "" )<br />
    : Exception( "Unsupported Version", what ) {}<br />
};<br />
<br />
/// Tag is not in the correct order<br />
struct TagOutOfOrder : public Exception<br />
{<br />
  TagOutOfOrder( int f = 0, const std::string& what = "" )<br />
    : Exception( "Tag specified out of required order", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Repeated tag not part of repeating group<br />
struct RepeatedTag : public Exception<br />
{<br />
  RepeatedTag( int f = 0, const std::string& what = "" )<br />
    : Exception( "Repeated tag not part of repeating group", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Repeated group count not equal to actual count<br />
struct RepeatingGroupCountMismatch : public Exception<br />
{<br />
  RepeatingGroupCountMismatch( int f = 0, const std::string& what = "" )<br />
    : Exception( "Repeating group count mismatch", what ),<br />
                 field( f ) {}<br />
  int field;<br />
};<br />
<br />
/// Indicates user does not want to send a message<br />
struct DoNotSend : public Exception<br />
{<br />
  DoNotSend( const std::string& what = "" )<br />
    : Exception( "Do Not Send Message", what ) {}<br />
};<br />
<br />
/// User wants to reject permission to logon<br />
struct RejectLogon : public Exception<br />
{<br />
  RejectLogon( const std::string& what = "" )<br />
    : Exception( "Rejected Logon Attempt", what ) {}<br />
};<br />
<br />
/// Session cannot be found for specified action<br />
struct SessionNotFound : public Exception<br />
{<br />
  SessionNotFound( const std::string& what = "" )<br />
    : Exception( "Session Not Found", what ) {}<br />
};<br />
<br />
/// IO Error<br />
struct IOException : public Exception<br />
{<br />
  IOException( const std::string& what = "" )<br />
    : Exception( "IO Error", what ) {}<br />
};<br />
<br />
/// Socket Error<br />
struct SocketException : public Exception<br />
{<br />
  SocketException()<br />
    : Exception( "Socket Error", errorToWhat() ) {}<br />
<br />
  SocketException( const std::string& what )<br />
    : Exception( "Socket Error", what ) {}<br />
<br />
  std::string errorToWhat()<br />
  {<br />
#ifdef _MSC_VER<br />
    error = WSAGetLastError();<br />
    char buffer[2048];<br />
    FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL, error,<br />
                   MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),<br />
                   buffer, 2048, NULL );<br />
    return buffer;<br />
#else<br />
    error = errno;<br />
    return strerror( error );<br />
#endif<br />
  }<br />
<br />
  int error;<br />
};<br />
<br />
/// Socket send operation failed<br />
struct SocketSendFailed : public SocketException<br />
{<br />
  SocketSendFailed() {}<br />
  SocketSendFailed( const std::string& what )<br />
    : SocketException( what ) {}<br />
};<br />
<br />
/// Socket recv operation failed<br />
struct SocketRecvFailed : public SocketException<br />
{<br />
  SocketRecvFailed( int size )<br />
    : SocketException( size == 0 ? "Connection reset by peer." : size < 0 ? errorToWhat() : "Success." ) {}<br />
  SocketRecvFailed( const std::string& what )<br />
    : SocketException( what ) {}<br />
};<br />
<br />
/// Socket close operation failed<br />
struct SocketCloseFailed : public SocketException<br />
{<br />
  SocketCloseFailed() {}<br />
  SocketCloseFailed( const std::string& what )<br />
    : SocketException( what ) {}<br />
};<br />
<br />
/*! @} */<br />
}<br />
<br />
#endif //FIX_EXCEPTIONS_H<br />
<br />

AnswerRe: Error in building QuickFix library in Exceptions.h Pin
David Crow9-Jul-10 9:04
David Crow9-Jul-10 9:04 
AnswerRe: Error in building QuickFix library in Exceptions.h Pin
Aescleal9-Jul-10 10:13
Aescleal9-Jul-10 10:13 
GeneralRe: Error in building QuickFix library in Exceptions.h Pin
arupsarkar16-Jul-10 6:46
arupsarkar16-Jul-10 6:46 
Questionerror C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
deadlyabbas9-Jul-10 5:23
deadlyabbas9-Jul-10 5:23 
QuestionRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
David Crow9-Jul-10 5:50
David Crow9-Jul-10 5:50 
AnswerRe: error C2440: 'static_cast' : cannot convert from 'LRESULT (__thiscall ................... Pin
Stuart Dootson11-Jul-10 0:46
professionalStuart Dootson11-Jul-10 0:46 
QuestionMFC crash occurs on DLL during language translation in string table entries Pin
Thirumalesh.U8-Jul-10 23:40
Thirumalesh.U8-Jul-10 23:40 
QuestionRun-time Error while word 2010 Automation, "A null reference pointer was passed to the stub." [modified] Pin
m_code8-Jul-10 23:04
m_code8-Jul-10 23:04 
AnswerRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 1:42
Niklas L9-Jul-10 1:42 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:07
m_code9-Jul-10 2:07 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 2:24
Niklas L9-Jul-10 2:24 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 2:48
m_code9-Jul-10 2:48 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
Niklas L9-Jul-10 3:14
Niklas L9-Jul-10 3:14 
GeneralRe: Runtime Error while word 2010 Automation, "A null refrence pointer was passed to the stub." Pin
m_code9-Jul-10 5:20
m_code9-Jul-10 5:20 
QuestionFile Mapping Pin
john56328-Jul-10 22:31
john56328-Jul-10 22:31 
AnswerRe: File Mapping Pin
Niklas L8-Jul-10 22:37
Niklas L8-Jul-10 22:37 
GeneralRe: File Mapping Pin
john56328-Jul-10 23:10
john56328-Jul-10 23:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.