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

After upgrading C++ toolset from 2010 to 2012: Whole project is rebuild for every change

$
0
0

Hi,

after upgrading the C++ toolset from 2010 to 2012, all of my projects hav the following issue: If I change only a single line of code, the whole project is rebuilt. This is very time consuming and pretty much impossible to work with. The MSBuild log shows the message ""will be compiled as it was not found in the tracking log" for each CPP file.

1>  Lesenachverfolgungsprotokolle: (Aufgaben-ID: 21)
1>      ...\cl.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.10052.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.10080.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.11116.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.11400.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.12428.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.12724.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.13004.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.13252.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.13800.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.13816.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.14304.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.14320.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.14784.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.1736.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.3568.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.5008.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6028.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6276.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6408.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6664.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6720.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.6884.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.7456.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.7732.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.7960.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.7972.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.8000.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.8328.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.8464.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.8672.read.1.tlog (Aufgaben-ID: 21)
1>      ...\CL.9804.read.1.tlog (Aufgaben-ID: 21)
1>  Ausgabedetails (175) wurden aus Leistungsgründen nicht protokolliert. (Aufgaben-ID: 21)
1>  ..\..\_Shared\C\Helper\PointerWatcher.cpp wird kompiliert, da sie im Nachverfolgungsprotokoll nicht gefunden wurde. (Aufgaben-ID: 21)
(same message for all other CPP files)
1>  Forcing rebuild of all source files due to a change in the command line since the last build. (Aufgaben-ID: 21)

Both using VS 2012 and 2015 have the same issue. Any solutions? Forcing a rebuild or deleting the "obj" folder does not help.


MS Visual Studio 2012 and 2013 ?

$
0
0

Dear Microsoft Visuall C++, 

I have MSVS 2013 installed on 2 of my machines but turns out some vendor programs/libraries I was given were compiled/built using MSVS 2013. 

Is it ok to install MSVS 2012 also onto my computer and use both 2012 and 2013 at different times? Or can I only install and use 1 at a time?

Any feedback is much appreciated. Thank you very much. 

Best, 

Juan

SetWindowPos() InsertAfter

$
0
0

What is InsertAfter parameter of SetWinowPos means

For ex: i have 4 windows. A,B,C,D. The location of A is at bottom end and D is at top end. i am calling SetWinowPos() of D with insert after A to change z-order.  

SetWinodwPos(hWnd_D,hWnd_A,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);

After call i got below z-order result

D,A,B,C where D at bottom end and C at top end

As per above InsertAfter means the window will moved behind InsertAfter window.

As per my understanding it was above the window.

Could anyone tell which one is correct?




Thanks, Renjith V R

I AM NOT ABLE TO RUN ANY PROGRAM INCLUDING THE SIMPLE HELLO WORLD PROGRAM.

$
0
0
I  am getting the file not  specified error.I think it all happened when I changed the setting, now Iam not able to sue it. I have inserted the image

Need Your Help

$
0
0
when someone enters a character in this code it shows invalid input i was looking for this programme  and i picked it  
from internet but i have a confusion in understanding the logic of programe  kindly some one explain the following parts 

1 why in this code the cin>>x is placed in the while testing condition and why the not operator is applied to it 

2 why is cin.clear(); used  and what is its purpose of using ?

3 why is cin.ignore(numeric_limits<streamsize>::max(), '\n'); is used and whats the purpose of this line ? i mean what it cause

4 Last why the limits header is included in this code


#include<iostream>
#include<limits>
#include <conio.h>
using namespace std;
int main()
{

cout << "Enter an int: ";
int x = 0;
while (!(cin >> x)){
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(), '\n');
cout << "Invalid input.  Try again: ";
}
cout << "You enterd: " << x << endl;
_getch();
return 0;
}
 

How do I execute an application linked to 2 different versions of MFC?

$
0
0

Hello,

I have created an application that builds a DLL along with an EXE that references several delivered runtime DLL's. The built DLL and EXE have been built with VS2012, and the delivered runtime DLL have been built with VS2010. When I attempt to execute the application, I will receive an access violation in WinMain (the call to AfxGetThread returns NULL). Just to verify the application, if the delivered runtime DLLs were also built with VS2012, the application executes successfully.

My goal is the execute the application without relinking it.

Is there a way to utilize a manifest config file, using and to change the references to VS2010 (made by the runtime DLLs) to VS2012 so that the application can be executed without relinking?

Here is the config file that I created, but was not successful:

<configuration><windows><assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1" ><dependentAssembly><assemblyIdentity type="win32" name="Microsoft.VC100.MFC" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" /><bindingRedirect oldVersion="10.0.40219.325" newVersion="11.0.60610.1" /><assemblyIdentity type="win32" name="Microsoft.VC100.CRT" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b" /><bindingRedirect oldVersion="10.0.40219.325" newVersion="11.0.51106.1" /></dependentAssembly></assemblyBinding></windows></configuration>

I am not sure if assembly names Microsoft.VS100.MFC and Microsoft.VS100.CRT are actually valid, and also not sure if I can redirect between major VS releases.

I have not been able to find any working examples. Any assistance would be helpful.

Regards, Rob

Installation failure

$
0
0

While attempting to install the 2010 Visual C++ software provided by a game (Assassin's Creed: Unity), the installation almost immediately failed. I have attempted restarting, fixing my DirectX, fixing my .Net framework, ensured it had admin privileges, and even tried a partial system restore to fix the problem, but it still continues. Any ideas?

OS Version = 6.2.9200, Platform 2
OS Description = Future OS - x64 
CommandLine = c:\412a035b3b8f86e7d5dc\Setup.exe 
TimeZone = Eastern Daylight Time
Initial LCID = 1033
Using Simultaneous Download and Install mechanism
Operation: Installing
Package Name = Microsoft Visual C++ 2010 x64 Redistributable Setup
Package Version = 10.0.40219
User Experience Data Collection Policy: UserControlled
Number of applicable items: 3
MSI (c:\412a035b3b8f86e7d5dc\vc_red.msi) Installation failed. Msi Log: Microsoft Visual C++ 2010 x64 Redistributable Setup_20150715_173854647-MSI_vc_red.msi.txt
Final Result: Installation failed with error code: (0x80070643), "Fatal error during installation. " (Elapsed time: 0 00:00:08).

Error while trying to run project: Unable to start debugging

$
0
0

Hello,

I am using MSVS Professional 2013, Version 12.0.31101.00 Update 4, and running on Win7 Service Pack 1.

I just created a "Win32 Console Application/Visual C++" project.

It is really as simple as "printf("Hello World!\n");

I try to run the program by pressing "Ctrl+F5" (Start withoutDebugging).

A dialog box appears that says: "Unable to start debugging. Failed to process configuration file. Try to restart this application. If failures continue, try to repair your installation."

I try to run the program again, this time by pressing "F5" (Start Debugging). I got the same dialog box and error message.

Please note that if I launch the console window and run the program from there, it is okay, i.e. I got my "Hello world!".

I am trying to determine what configuration file needs to be processed.

Please note I have already tried the following things and they all failed:

1) Restart my Visual Studio (4 times)

2) Reboot my computer (2 times)

3) Reset all settings (Tools->Import and Export Settings->Reset all settings) (2 times)

4) Create a similar project in C# (Console Application/Visual C#)

This is very peculiar and clearly is not isolated to VC++ only. I would appreciate some assistance in this matter.

Regards,

ESec1


Removed checkbox reappears in treeview node when spacebar is pressed in MFC CTreeCtrl?

$
0
0
  

Here is the WM_INITDIALOG handler that illustrates the problem:

  BOOL OnInitDialog()
    {

      CPropertyPage::OnInitDialog();
    //Setting Treecontrol with TVS_CHECKBOXES style

      HWND m_hTreeWnd = ::GetDlgItem(m_hWnd,IDC_TREE);
      DWORD dwStyle =  GetWindowLong(m_hTreeWnd,GWL_STYLE);
      dwStyle |= (TVS_CHECKBOXES);
      SetWindowLongPtr(m_hTreeWnd,GWL_STYLE,dwStyle);//CTreeCtrl m_hTreeWnd;



    //Now I had initialized the tree control and I am want only few items of the tree to have
      //checkboxes,In order to achieve that I did it as follows(Removing checkboxes where not required)

      tvInsertItem.hParent = NULL;
      tvInsertItem.hInsertAfter = TVI_ROOT;
      tvInsertItem.item.mask = TVIF_TEXT|TVIF_IMAGE|TVIF_SELECTEDIMAGE;
      tvInsertItem.item.pszText = L"Name"
      hParentItemHandle = m_TreeCtrl.InsertItem(&tvInsertItem);

      //Removal of checkboxes for the above item
      tvItem.hItem = hParentItemHandle;
      tvItem.mask =      TVIF_TEXT|TVIF_STATE|TVIF_SELECTEDIMAGE;
      tvItem.stateMask = TVIS_STATEIMAGEMASK;
      tvItem.state = 0;
      tvItem.pszText = szCommonModel;
      m_TreeCtrl.SetItem(&tvItem);


    }
  

Everything is fine I removed checkbox in which ever the node it is not required.And added checkbox where ever they are required(node).

I noticed an issue i.e, after selecting an item in the tree control which does not have check box ,now if
I press "space bar"then a checkbox is getting append to that item.

I want remove the check box when I press space bar.
To avoid checkbox I tried this but did not work.

  BOOL CTreeControlDlg::OnTvnItemChangingTree(UINT i,NMHDR *pNMHDR, LRESULT *pResult)
    {
	NMTVITEMCHANGE *pNMTVItemChange = reinterpret_cast<NMTVITEMCHANGE *>(pNMHDR);

	HTREEITEM hTree = pNMTVItemChange->hItem;
	UINT ChangItem = pNMTVItemChange->uStateNew;
	UINT ChangItem1 = pNMTVItemChange->uStateOld;
	UINT ItemState = m_TreeCtrl.GetItemState(hTree, TVIS_STATEIMAGEMASK);
	if(ChangItem == ItemState)

          return FALSE;

// checking whether the state change involvesTVIS_STATEIMAGEMASK I am not sure how do we check the changed state.



	return TRUE;
    }


Can anyone please suggest me a way to remove the check box for the nodes where I don't want checkbox.

                                              

SivaV

Implement WinRM in C++??

$
0
0
Can I use the C++ API for WINRM in Linux to make connection/execute powershell command with/on a Windows Machine?? If yes, then can someone paste sample code for the same??

Not able to access .Net assembly in MFC application

$
0
0

We are having an application written in MFC which compiles using Static Release and Static Debug and We want to use managed dll in this application.

To use managed dll I have changed Project Property, Properties->Configuration Properties->General->Common Language Runtime Support to Common Language Runtime Support(clr).

Also added reference for managed dll from Project->Properties->Common Properties->Framework And References but while accessing manged assembly I am Getting this error 

Error2 error C2871: 'System' : a namespace with this name does not exist.

Am I missing some setting in properties, please help.

Thank you, 

 


Thanks.

Interprocess communication

$
0
0

I have a running process.  It creates several other processes, each of which displays a small window.  (These are separate processes, not threads.)

If a user minimizes the main process, I want all the other process windows to get minimized as well.

If the main process is restored, I want the others to get restored as well.

What's the best procedure?  OpenProcess() sounds like a good route.  Can anyone show how to use it?  Is there a better way?

How to increase the separator width in CMFCToolBar control?

$
0
0

I try to increase the space between 2 buttons in the toolbar, the side affect is that the toolbar will have extra space at the end of toolbar.  I already reported this problem to Microsoft (http://connect.microsoft.com/VisualStudio/feedback/details/1447929/cmfctoolbar-with-extra-separator).  When I look at the CMFCToolBar class, I can see the virtual function

virtualvoidOnCalcSeparatorRect(CMFCToolBarButton* pButton, CRect& rectSeparator,BOOLbHorz);

But, doesn't matter how increase the rectSeparator width, the result is always the same.  Is this a bug?  How do I resolve this problem?

Thanks

Steve

exception specification cannot appear in a typedef declaration

$
0
0

I get the error "Exception Specification cannot appear in a typedef declaration" in VS2015 and it seems to be coming from

template<typename T,bool isp,bool b1,bool b2>struct ct_imp{typedefconst T& param_type;};

and in other place

template<typename T>struct call_traits{public:typedef T value_type;typedef T& reference;typedefconst T& const_reference;//// C++ Builder workaround: we should be able to define a compile time// constant and pass that as a single template parameter to ct_imp<T,bool>,// however compiler bugs prevent this - instead pass three bool's to// ct_imp<T,bool,bool,bool> and add an extra partial specialisation// of ct_imp to handle the logic. (JM)typedeftypename boost::detail::ct_imp<
      T,::boost::is_pointer<T>::value,::boost::is_arithmetic<T>::value,::boost::is_enum<T>::value>::param_type param_type;};

in call_traits.hpp file. The above template is instantiated in one other file "compressed_pair.hpp" and face same error in these places too.

class compressed_pair_imp<T1, T2,2>:protected::boost::remove_cv<T2>::type{public:typedef T1                                                 first_type;typedef T2                                                 second_type;typedeftypename call_traits<first_type>::param_type       first_param_type;typedeftypename call_traits<second_type>::param_type      second_param_type;typedeftypename call_traits<first_type>::reference        first_reference;typedeftypename call_traits<second_type>::reference       second_reference;typedeftypename call_traits<first_type>::const_reference  first_const_reference;typedeftypename call_traits<second_type>::const_reference second_const_reference;

These are boost files and I've not modified those. While i build my current project in vs2015 with new boost 1.58 libraries, I get this error.

To add more, initially, I faced the error

Error C3859 virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm128' or greater. Error C1076 compiler limit: internal heap limit reached; use /Zm to specify a higher limit.

To handle this, I added /Zm120 /Ze as additional option in command line compiler option. As a result, I cleared virtual memory error, but ended with exception specification cannot appear in typedef error. May I know how to resolve this.


Why Add Variable won't work in Winform ActiveX

$
0
0

Currently, I wants to make an Active X control using Winform and implement exactly as http://www.codeproject.com/Articles/24089/Create-ActiveX-in-NET-Step-by-Step

Everything is OK until I want to use this Active X control in a MFC application:

When I click "Add Variable" as usual, VS give me a message "Cannot access ActiveX control library". I've been trying some popular sample code of Winform AcitveX on the internet. They also have this problem.

I list some details below:

1) I can insert ActiveX control in resource view, when debug, the control can show correctly.

2) When I want to "Add Variable", "Cannot access ActiveX control type library" come out.

3) I can use some workaround to use this ActvieX (find the control, and query interface)

I would like to ask:

1) Is there something wrong in our Active X code, do we miss something?

2) Or, does Winform ActiveX have some natural weakness which cause something wrong in design time? (as we know, winform ActiveX is a "dll", while other common ActiveX is "ocx")










COUNTING LETTERS SPACES AND WORDS IN THE NAME

$
0
0

THIS PROGRAME COUNTS THE NUMBER OF LETTERS AND SPACES IN THE NAME  BUT MY QUESTION IS HOW TO COUNT WORDS IN THE NAME    KINDLY HELP ME IN THE EASY WAY    and    please  do not  change the code 

#include <iostream>
#include <conio.h>

using namespace std;
void main()
{

char khan[30];
int name_counter = 0;
int space_counter = 0;

system("color 1B");
cout << " enter your name ";
cin.getline(khan, 30);

for (int i = 0; khan[i] != '\0'; i++)
{
name_counter++;
if (khan[i] == ' ')
{
name_counter--;
space_counter++;

}
}
cout << endl << endl;
cout << " Your Complete     Name  :  "<<khan << endl << endl;
cout << " LETTERS  In Your  Name Is " << name_counter << endl << endl;
cout << " spaces In Your    Name Is " << space_counter <<endl <<endl;
cout << " Total Character Used In Programe IS " << (name_counter + space_counter);




How to get 'uSNCreated' attribute value of user object in active directory

$
0
0

I have tried with Iadsuser interface  with get() method. ( c++ , COM programming with IADs & LDAP interfaces )

after executing Iadsuser.get ( "uNSChanged" , CComVar1  ); // executed fine .. returned S_OK ( hresult ) 

1) after executing get() method , I am not sure which CComVar class member value should take. 

2) I have checked  all member variables of CComvar , But not variable having exact uNSChanged value. 

3) I have tried same Get() method for others like name , displayname , admincount etc. everything working fine

How to get uSNChanged attribute value. Is there any other mentod to find it.. 


ban.dev

VC 2012 Release Build encounter startup error

$
0
0

I'm building a pure Win32 program (no clr or any assembly) by VC 2012 (VC 2012 (VC11) as my compiler). It uses boost 1.58, wxWidget 3.0.2 series,gsl 1.8, jsoncpp, Open CV 2.4.10, etc... The development box is running Win7 64bits. I would like it to be a single executable and is able to run on both Win 7 32/64 so I built all of the above packages as libs myself by the same VC 2012. (thanks for cmake)...

It works fine on development box but not on a clean one that only installed VC redistribution packages. I got the error message box ask me to use the sxstrace and the message in event log has side-by-side error like below and I also tried the sxstrace and got similar error.

"D:\Release\xxxx.exe" 的啟用內容產生失敗。 找不到依存組合 Microsoft.VC90.DebugCRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="9.0.21022.8"。 請使用 sxstrace.exe 進行詳細的診斷。

I've been searching around. All and answers simply says I should use all release build for all libs. Yes, it's true if I didn't I couldn't have the single executable at first place. It won't be able to link. (I learned it by made lots of mistakes) I've tried both MD or MT build for my program (not mix them together. They are separated test.). Either of the mode works. The same error remains. I've also installed over lots of VC2008 9.0.21022, -.30729.17, -30729.4148, -30729.6161, VC 2010 10.0.40219, VC 2012 11.0.61030 (x86/x64)

I really don't understand. It's pure win32 release build made by VC 2012. How come it requires VC90 debug dll?

A further test is: Just try to load it with WinDbg. It works fine on my development box, however it still crashes on a clean box. On the clean box, I could not even see the information that it loads every dll but told me Connot load xxx.exe. I saw a short infor "win32 error on14001". I searched it from some other place. The error code says 'the application configuration is incorrect. Reinstall the application may fix this problem'.  What should I configure? It's not a managed program but a standalone executable...

I'll really appreciated if someone can give me more precise advice about how to resolve or even determine where and what goes wrong with the code or the lib I build.

mfc read explicit dll

$
0
0

Hi,

I am looking for some sample code on reading a DLL using explicit linking.

I am using VS 2013, I am developing an MFC app. It is a third party DLL.

Anyone got any ideas where I might be able to find sample code. Any help gratefully appreciated.

thankyou

SetWindowPos() InsertAfter

$
0
0

What is InsertAfter parameter of SetWinowPos means

For ex: i have 4 windows. A,B,C,D. The location of A is at bottom end and D is at top end. i am calling SetWinowPos() of D with insert after A to change z-order.  

SetWinodwPos(hWnd_D,hWnd_A,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);

After call i got below z-order result

D,A,B,C where D at bottom end and C at top end

As per above InsertAfter means the window will moved behind InsertAfter window.

As per my understanding it was above the window.

Could anyone tell which one is correct?




Thanks, Renjith V R

Viewing all 15302 articles
Browse latest View live


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