Quantcast
Channel: Visual C forum
Viewing all 15302 articles
Browse latest View live

Red squiggles after installing update 2 for VS 2013

$
0
0

Hi,

After installing update 2 for vs 2013, I now get these red squiggles in my editor. Here is a sample code showing them (the char is unicode). Please note that the code compiles ok, it is just those annoying squiggles!


include "stdafx.h"
#include <iostream>

#define WIDEN2(x) L##x
#define WIDEN(x) WIDEN2(x)
#define __WFILE__ WIDEN(__FILE__)
#define __WFUNCTION__ WIDEN(__FUNCTION__)

using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
  wcout << L"Function " << __WFUNCTION__ << L" file " << __WFILE__ << endl;
	return 0;
}

The squiggles are under  __WFUNCTION__ Even more strange, they are NOT shown under __WFILE__

Thanks G.



WSASend() and completion events

$
0
0

Windows 7, C++, VS2008 and VS2012

Ref microsoft page:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms742203(v=vs.85).aspx

it says:

If an overlapped operation completes immediately, WSASend

returns a value of zero and the lpNumberOfBytesSent

parameter is updated with the number of bytes sent.

If the overlapped operation is successfully initiated

and will complete later, WSASend returns

SOCKET_ERROR

and indicates error code WSA_IO_PENDING.

Trying to avoid excessive detail:  The code I am writing uses completion events to signal that the send operation has completed and the buffer can be written to again.

If WSASend returns a zero, will the event be set or possibly not be set?

If the event is set, I think all is good.  But, if the event is not set, then I presume I should set it so that only one piece of code attends to that particular operation.  (signaling that the buffer can now be written to)

Edit: I just realized that the expected return value is SOCKET_ERROR and that I must call WSAGetLastError each time to ensure that the error code is
WSA_IO_PENDING.  I cannot just check the return value forWSA_IO_PENDING.  Is that correct?


~jag77 We need to know what a dragon is before we study its anatomy. (Bryan Kelly, 2010)




MFC: Updating Ribbon bar from dedicated thread. PostMessage() doesn't work

$
0
0

I use MVS 2013 native c++

I am making a simulation tool, that runs simulation (in a separate thread) over user defined number of iterations, which can be entered in an Edit control on the Ribbon Bar. I would like to reuse it to show current iteration during simulation. I also also put CMFCRibbonProgressBar to show the progress. The Ribbon Bar is created with resource editor. 

The conventional way over ON_UPDATE_COMMAND_UI routines requires activity in the window, like moving the mouse.

So I thought I make a dedicated thread for that. Of course I fell in usual pitfall and put following code under my CDocument derived class:

void MyDocument::StartSimulation()
{
	simulating = TRUE;//
	std::thread simulation([this]{//create thread for simulation
		simulator.simulate(num_iterations); //launch simulation
		this->simulating = FALSE; 
	});
	simulation.detach();

	std::thread updating([this]{
		
		while (simulating)
		{ 
		
		CStringW iteration(L"%d");
		 while (simulating)
		{iteration.Format(L"%d", simulator.getCurrentIteration());


		rbedit->SetEditText(iteration);//rbedit is the pointer to CMFCRibbonBarEdit I store in my document

		pb->SetPos(simulator.getCurrentIteration());//pb is the pointer to CMFCRibbonProgressBar
		iteration = L"%d";
			std::this_thread::sleep_for(std::chrono::milliseconds(40));//prevents unneccesary load
		}
	iteration.Format(sumulator.getCurrentIteration());
	rbedit->SetEditText(iteration);
	pb->SetPos(simulator.getCurrentIteration());
	});
	updating.detach();
}

As you expect the code caused almost all possible debug assertions to fail.

I did some additional research and in many places including this forum it is suggested to post update messages back to window thread. So I changed the code to

void MyDocument::StartSimulation()
{
	simulating = TRUE;//
	auto h = static_cast<CMainFRame*>(AfxGetMainWnd())->m_hWnd;
	std::thread simulation([this]{//create thread for simulation
		simulator.simulate(num_iterations); //launch simulation
		simulating = FALSE; 
	});
	simulation.detach();

	std::thread updating([this,&h]{
	while (simulating)
	{ 
		::PostMessage(h, WM_UPDATE_VISUALS, waves[current_wave].getCurrentIteration(), 0);
	//	std::this_thread::sleep_for(std::chrono::milliseconds(500));
	}
	});
	updating.detach();
}

in the message map of the main window:

ON_MESSAGE(WM_UPDATE_VISUALS, &CMainFrame::OnUpdateVisuals)

the message handler for it:

afx_msg LRESULT CMainFrame::OnUpdateVisuals(WPARAM wParam, LPARAM lParam)
{
CStringW iterations(L"");
progress->SetPos(wParam);//progress pints to the progress bar
iterations.AppendFormat(L"%d", wParam);
edit->SetEditText(iterations);//edit to the edit box

return 0;
}

Some weird things happen: I put a breakpoint in the message handler above. if I leave sleep_for commented out it gets hit only few times. if i leave it as it is. it is simply never hit.

So what is the way to  get the controls timely updated to reflect the progress without causing the GUI become unresponsive?

I have an additional question. I also need to tell the document to UpdateAllViews() after the first thread finishes. Since a document is not a window I can't post messages to it. I tried posting messages to the main window and to the view

std::thread simulation([this, &h]{//create thread for simulation
		simulator.simulate(num_iterations); //launch simulation
		simulating = FALSE; 
		::PostMessageW(h, WM_UPDATE_VIEWS, 0,0);
	});
neither worked - the respective handlers were never hit. How should i do it?



Cannot compile C++ project by Visual Studio 2013

$
0
0

Hi

I have downloaded IfcPlusPlus Viewer (https://code.google.com/p/ifcplusplus)

and now I'm trying to compile it by Visual Studio 2013 but I get the following errors 

Error51 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp691 carve
Error52 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp1421 carve
Error53 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp1431 carve
Error54 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp1731 carve
Error55 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp2941 carve
Error56 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp2951 carve
Error57 error C2264: 'cbrt' : error in function definition or declaration; function not calledC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\math.cpp3031 carve
Error1 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error2 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve_misc
Error3 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error14 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error16 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error17 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error18 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error19 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error50 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error58 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error60 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error61 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error62 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error64 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error66 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error67 error C2375: 'cbrt' : redefinition; different linkageC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\math.h4821 carve
Error25 error C2440: 'initializing' : cannot convert from 'const carve::csg::IObjPairSet' to 'const carve::csg::IObj &'C:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\intersect.cpp6411 carve
Error24 error C2440: 'initializing' : cannot convert from 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const carve::csg::IObj,const carve::csg::IObj>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'C:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\intersect.cpp6391 carve
Error5 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error9 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error12 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error21 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error28 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error31 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error35 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error38 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error41 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error45 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error48 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error69 error C2440: 'initializing' : cannot convert from 'std::_Tree_const_iterator<std::_Tree_val<std::_Tree_simple_types<std::pair<const _Kty,_Ty>>>>' to 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>'c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error6 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error10 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error13 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error22 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error29 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error32 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error36 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error39 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error42 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error46 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error49 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error70 error C2678: binary '!=' : no operator found which takes a left-hand operand of type 'std::_List_const_iterator<std::_List_val<std::_List_simple_types<std::pair<const _Kty,_Ty>>>>' (or there is no acceptable conversion)c:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error4 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error8 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error11 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error20 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error23 error C3083: 'data_type': the symbol to the left of a '::' must be a typeC:\Users\Garnik\Desktop\ifcplusplus\Carve\src\lib\intersect.cpp6391 carve
Error27 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error30 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error34 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error37 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error40 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error44 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error47 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error68 error C3083: 'data_type': the symbol to the left of a '::' must be a typec:\Users\Garnik\Desktop\ifcplusplus\Carve\src\include\carve\intersection.hpp1201 carve
Error779 error D8016: '/Ox' and '/RTC1' command-line options are incompatibleC:\Users\Garnik\Desktop\ifcplusplus\bin\SimpleViewer\clIfcPlusPlusViewer
Error778 error LNK1104: cannot open file '..\Debug\carve.lib'C:\Users\Garnik\Desktop\ifcplusplus\bin\IfcPlusPlusGeometry\LINKIfcPlusPlusGeometry

Please advise!

MFC Static/Shared has no effect

$
0
0

Hello,

I am using VS 2008. My dll will not registered on a clean machine but changing the linking of MFC as static or shared has no effect - OCX remain the size (I know my OCX, there should be a 100KB difference).

Please advice,

Nahum

Change the text in a static control to bold

$
0
0

I try to change the text in a static control to bold, as follows:

void SetWndTextBold(CWnd *pWnd)
{
    CFont *pFont;
    CFont BoldFont;
    LOGFONT LogFont;

    if (pWnd != NULL)
    {
        pFont = pWnd->GetFont();

        //  Get log font for the given window
        if ((pFont != NULL) && (pFont->GetLogFont(&LogFont)))
        {
            //  Change the weight to bold
            LogFont.lfWeight = FW_BOLD;

            //  Set the bold font for the given window
            BoldFont.CreateFontIndirect(&LogFont);

            pWnd->SetFont(&BoldFont);

            //  Done with the font. Delete the font object.
            BoldFont.DeleteObject();
        }
    }
}

Then invoke

SetWndTextBold(GetDlgItem(IDC_MY_STATIC))

to set the control IDC_MY_STATIC to bold.

Now I have two questions:

1. Whether I should invoke BoldFont.DeleteObject() after calling pWnd->SetFont(&BoldFont), since the control still exists and contain a reference to the fold? Will that cause the control to refer to a Font object that has already been deleted?

2. When calling the function, I find the text becomes bold. However, the font size also increases, what is not expected. Why?

Thanks

'global_map_num_args' : non-aggregates cannot be initialized with initializer list; too many initializers

$
0
0

Hi

I'm using Visual Studio 2012 Express

I have downloaded the IfcPlusPlus  from here (https://code.google.com/p/ifcplusplus/) where mentioned that this project developed and tested with VS 2012.

When I compile this project  I get the following errors in my library class 

'global_map_num_args' : non-aggregates cannot be initialized with initializer list
too many initializers

And this is the code where occured error

static std::map<IfcPPEntityEnum, int> global_map_num_args = {
	{ IfcPPEntityEnum::IFCBEAM, 9 },
	{ IfcPPEntityEnum::IFCBUILDINGELEMENTPART, 9 },
	{ IfcPPEntityEnum::IFCCLASSIFICATION, 7 },
	{ IfcPPEntityEnum::IFCCLASSIFICATIONREFERENCE, 6 },
	{ IfcPPEntityEnum::IFCCOLOURRGB, 4 },
	{ IfcPPEntityEnum::IFCCOLUMN, 9 },
	{ IfcPPEntityEnum::IFCCSHAPEPROFILEDEF, 8 },
	{ IfcPPEntityEnum::IFCCURTAINWALL, 9 },
	{ IfcPPEntityEnum::IFCCURVESTYLE, 5 },
	{ IfcPPEntityEnum::IFCDISCRETEACCESSORY, 9 },
	{ IfcPPEntityEnum::IFCDISCRETEACCESSORYTYPE, 10 },
	{ IfcPPEntityEnum::IFCDISTRIBUTIONPORT, 10 },
	{ IfcPPEntityEnum::IFCDOCUMENTREFERENCE, 5 },
	{ IfcPPEntityEnum::IFCDOOR, 13 },
	{ IfcPPEntityEnum::IFCDOORLININGPROPERTIES, 17 },
	{ IfcPPEntityEnum::IFCFASTENER, 9 },
	{ IfcPPEntityEnum::IFCFILLAREASTYLE, 3 },
	{ IfcPPEntityEnum::IFCFLOWTERMINAL, 8 },
	{ IfcPPEntityEnum::IFCFURNITURETYPE, 11 },
	{ IfcPPEntityEnum::IFCGRID, 11 },
	{ IfcPPEntityEnum::IFCISHAPEPROFILEDEF, 10 },
	{ IfcPPEntityEnum::IFCLIBRARYREFERENCE, 6 },
	{ IfcPPEntityEnum::IFCLSHAPEPROFILEDEF, 9 },
	{ IfcPPEntityEnum::IFCMATERIAL, 3 },
	{ IfcPPEntityEnum::IFCMATERIALLAYER, 7 },
	{ IfcPPEntityEnum::IFCMATERIALLAYERSET, 3 },
	{ IfcPPEntityEnum::IFCMATERIALLAYERSETUSAGE, 5 },
	{ IfcPPEntityEnum::IFCMATERIALPROFILESETUSAGE, 3 },
	{ IfcPPEntityEnum::IFCMECHANICALFASTENER, 11 },
	{ IfcPPEntityEnum::IFCMECHANICALFASTENERTYPE, 12 },
	{ IfcPPEntityEnum::IFCMEMBER, 9 },
	{ IfcPPEntityEnum::IFCOPENINGELEMENT, 9 },
	{ IfcPPEntityEnum::IFCPLATE, 9 },
	{ IfcPPEntityEnum::IFCPOSTALADDRESS, 10 },
	{ IfcPPEntityEnum::IFCPROJECT, 9 },
	{ IfcPPEntityEnum::IFCPROPERTYBOUNDEDVALUE, 6 },
	{ IfcPPEntityEnum::IFCPROPERTYSINGLEVALUE, 4 },
	{ IfcPPEntityEnum::IFCPROPERTYTABLEVALUE, 8 },
	{ IfcPPEntityEnum::IFCQUANTITYAREA, 5 },
	{ IfcPPEntityEnum::IFCQUANTITYCOUNT, 5 },
	{ IfcPPEntityEnum::IFCQUANTITYLENGTH, 5 },
	{ IfcPPEntityEnum::IFCQUANTITYVOLUME, 5 },
	{ IfcPPEntityEnum::IFCQUANTITYWEIGHT, 5 },
	{ IfcPPEntityEnum::IFCRAMPFLIGHT, 9 },
	{ IfcPPEntityEnum::IFCREINFORCINGMESH, 18 },
	{ IfcPPEntityEnum::IFCSIMPLEPROPERTYTEMPLATE, 12 },
	{ IfcPPEntityEnum::IFCSPACETYPE, 11 },
	{ IfcPPEntityEnum::IFCSTAIRFLIGHT, 13 },
	{ IfcPPEntityEnum::IFCSTRUCTURALANALYSISMODEL, 10 },
	{ IfcPPEntityEnum::IFCSTRUCTURALPOINTCONNECTION, 9 },
	{ IfcPPEntityEnum::IFCSTRUCTURALCURVEMEMBER, 9 },
	{ IfcPPEntityEnum::IFCSURFACESTYLE, 3 },
	{ IfcPPEntityEnum::IFCSYSTEMFURNITUREELEMENTTYPE, 10 },
	{ IfcPPEntityEnum::IFCTSHAPEPROFILEDEF, 12 },
	{ IfcPPEntityEnum::IFCTELECOMADDRESS, 9 },
	{ IfcPPEntityEnum::IFCTEXTSTYLE, 5 },
	{ IfcPPEntityEnum::IFCTRANSPORTELEMENT, 9 },
	{ IfcPPEntityEnum::IFCUSHAPEPROFILEDEF, 10 },
	{ IfcPPEntityEnum::IFCWALL, 9 },
	{ IfcPPEntityEnum::IFCWALLSTANDARDCASE, 9 },
	{ IfcPPEntityEnum::IFCWINDOW, 13 },
	{ IfcPPEntityEnum::IFCWINDOWLININGPROPERTIES, 16 },
	{ IfcPPEntityEnum::IFCZONE, 6 }
};

Is there any solution for Visual Studio 2012

please help!

WSASend and WSAEWOULDBLOCK

$
0
0

Windows 7 and XP, Visual Studio 2008, 2012, C++

Non blocking sockets, overlapped I/O, completion events

I do not have the code working yet but am writing the mechanisms to handle error conditions. 

Question: What should be done if WSASend() solicits the error WSAEWOULDBLOCK

Presume the link has been established and some number of sends have successfully completed.

This page:http://msdn.microsoft.com/en-us/library/windows/desktop/ms740668(v=vs.85).aspx#WSAEWOULDBLOCK

Says, in part: It is a nonfatal error, and the operation should be retried later.

I am hoping someone will provide a better definition of: later

Should the code call Sleep( x ). Is there an event or some other indicator that can trigger actions “later?”

I have searched this for a while and did not find an answer. If you have a link to an answer, that would be cool. 


~jag77 We need to know what a dragon is before we study its anatomy. (Bryan Kelly, 2010)


gdiplusenums.h(28): error C4430: missing type specifier

$
0
0

Hi Folks:

   Developing on Win 8.1 Pro, Visual Studio 2010, C++. 

   Why am I seeing these errors? 

    1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gdiplusenums.h(28): error C2146: syntax error : missing ';' before identifier 'GraphicsState'
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gdiplusenums.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\program files (x86)\microsoft sdks\windows\v7.0a\include\gdiplusenums.h(28): error C4430: missing type specifier - int assumed.

  I've examined the preprocessor's output and this is being included in a statement inside  gdiplus.h. 

   An examination of the SDK's include directory indicate that nothing has been modified, so I believe that means nothing has been corrupted, since 2009. 

FindWindow() API used inside a DLL is not able find target window when used in Server 2008 OS

$
0
0

Hi,

Scenario :

In Win 7 OS (32-bit), an EXE calls a dll's function, this function inside the DLL finds the target window (using FindWindow() function )and is able to send messages to the Target Window successfully via SendMessage() - WM_COPYDATA technique.

Problem : When I use the same dll as a plugin DLL to a server, it fails to find the target window in Server 2008 R2 OS (32-bit)

Can someone give me a solution ?

Thanks in advance,

Adi Koshy

VC++ 2013 tan() causes illegal instruction exception in x64

$
0
0

I've encountered what I believe to be a compiler bug, but am unsure at the moment.

Background:

I've got a program which builds and runs fine in VS2010 for both debug/release on Win32/64.

I recently upgraded to VS 2013, update 3 and am now getting illegal instruction exceptions that crash my program.

This only happens when building for x64, and not for Win32. The bug can be reproduced very easily with this code:

float f = 8388608.0;
float f2 = tan(f);//Crashes

This doesn't happen when using double, only with float, and only on x64.

I'm stumped as to what could be the problem and am suspecting the compiler.

My CPU: AMD Phenom II


Any help is greatly appreciated. Thanks.

What are disadvantages if we stop the Desktop Window Manager Session Manager - windows service in Windows 7 OS

$
0
0

What are disadvantages if we stop the Desktop Window Manager Session Manager - windows service in Windows 7 OS ?


www.tnvbalaji.com

CMDIChildWndEx with ShowWindow function

$
0
0

When I use MFC Feature Pack with MDI, with the old MDI, I can hide the MDI windows by calling ShowWindow( SW_HIDE ). If the tab is in use, the ShowWindow function does not work, the MDI window is still visible.

I just wonder how can I trap this message & call ActivateFrame to hide it?  Since our application is so huge, it will much easier to trap in the child class instead of search all the code & replace them.

Thanks,

Steve

Can you mix RTTI settings when building an app?

$
0
0

I encountered an application crash earlier this week that I can attribute to a mixing of RTTI settings. The application did not have RTTI enabled (/GR-) but the static libraries it linked to did (/GR). Code from the static library called a type id function on a class in the same library and that crashed the application. Since static libraries are part of the application essentially, I think this could be legit behavior. But I can't find it documented.

I am thinking about filing this as a bug, if only to ask for future updates of Visual Studio to warn or error if there is an RTTI mismatch. Before I do though I'd like any input you guys have. Do you consider this a bug? Have you ever encountered anything like this before?

You can read the background here:
#16431 (wxTypeId() without RTTI crashes in Visual Studio) – wxWidgets

Thanks

Extracting a substring using Regex

$
0
0

Hi,

I need to extract text between the first set of parentheses in a given string input (input is the variable name). For example if I have

a + (b/c)-(c+a) 

I need "b/c" (without quotes). I tried the regex ".*((\\w+).*" and want to use regex_search function, but I couldn't find a proper overload. 

1. Is my regex match right?

2. According to this, I should be searching between input.begin() and input.find_first_of(")"), am I right?

How do I extract the substring using regex?


I believe the code below doesn't compile because of §7.3.1.2/3 in the C++11 Standard. But I still need some assistance on this.

$
0
0

This code doesn't compile, as can be seen here.

#include <iostream>

//class X;
//X operator+(X,X);

class Y {};
class X {
public:    
    X(int i): _i(i) {}    
    X(Y):X(103){}
    friend X operator+(X a, X b) { return a._i + b._i; }
    void print() { std::cout << _i << '\n'; }
private:
    int _i;
};

void f() {
   Y y1, y2;
   (y1 + y2).print();
   X x1(1); 
   (x1 + y1).print();
}

int main()
{
    f();
}

But once the lines 3 and 4 are uncommented, it compiles and executes normally.

It seems like the explanation is given by §7.3.1.2/3 in the Standard, but this is still not clear to me.

Linking HTMLHelp?

$
0
0

Hi Again Folks:

   Developing on Win 8.1 pro, VS 2010 Pro. 

   I'm working through the tedious task of recreating my application, creating a new "Solution" and copying each of the hundreds of C++ modules into the application's library project, one at a time, as the linker tells me it's found an unresolved external reference. 

   I've come upon:

      error LNK2019: unresolved external symbol _HtmlHelpA@16

  Google tells me a lot, but I'm not finding a page that shows the requirements, .lib name or some hint as to what I need to do, to link the help system into my application. 

   I know this information is out there somewhere. 

   Suggestions please.

      Thanks
      Larry

  


Binary com over serial port

$
0
0

I know this question has been asked in many different forms and I HAVE referred to all I can find. Still I can not make this work. I'm going to make this as simple as possible. I am using Visual C++ 2013. All I want to do is write 8 bit binary data out a serial port EXACTLY as I specify it. I don't want any built-in MS big brother code screwing with the data first before it goes out. You don't need me to show you any actual code. I'm sure someone out there does this routinely. So show me how, in painfully great detail, how to send this string:

String ^getStatus  = "\xb6\xc6\x00\x01\x00\x83";

out a serial com port so that it shows up at the other end looking like:

0xb6 0xc6 0x00 0x01 0x00 0x83 because when I try, it I get:

0x3F 0x3F 0x00 0x01 0x00 0x3F

I've been pulling my hair out all day on this. Don't ask me any questions about encoding, or byte arrays, or wide char arrays, etc. Just show me how you would do it.

thanks to whoever answers

Writing a number translator in C, need help with my array.

$
0
0

First off, sorry to all the people that are going to say "There is already a post just like this!".

But I do not even really know enough about what it is I'm looking for to find it on the forum. So. Whatever, <3

 What I am trying to do is write a program that will take a number I punch in, say 2 and spit out the Japanese translation, "ni", hopefully up to 1000. This is just a project I am working on for practice and fun, so the spec. can change if I need it to.   

This is what I have produced thus far:

      int main (int argc, char* argv[]){

       double lttRizer[5];  // declaring my array. "Letterizer"

       printf("Please enter a number:\n");
       scanf("%d", &lttRizer);
       printf("%d", lttRizer);
    
      return 0;
}

                        The result of this is a long [6 or 7 digits] number that changes when I try to manipulate the declaration of my array, which leads me to believe it is giving me the address of my array(?).

                        Anyway the Japanese number system works like our own, (they count to "twenty" and then "twenty-one" and so on). So if i can get this to work it should start to come together with like ...

          if (lttRizer[1] == 1);  //or maybe while?

           case1

           case2 ... ...

      if (lttRizer[1] == 2);

         case1

         case 2 ...

}

Sorry again, to ppl who know what a proper program looks like for the savagery.

So I guess what I am looking for is clarification on the array type and just all the advice I can get.

  I am very new to all of this so... PLS SAVE ME! haha

 


'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

$
0
0

Hi all, the error in the title appeared when I was trying to use inet_addr.

I added the line below as advised by the compiler, but the eror still appears.

#define _WINSOCK_DEPRECATED_NO_WARNINGS

Can anyone advise on this error? Thank you!

Viewing all 15302 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>