C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.

Share tech news, updates, or what's on your mind.

Sign up to Post

We will install a visual studio version, probably 2015 or 2017 so that we can be ready for the present someday in the future. But for now we have to deliver our source code to the customer who only knows about Iso c++03.

This means that if a developer inserts some newer c++11/14 constructs into our code base, then I want the computer to issue fatal errors forcing the developer to have to conform to c++03.

I found this link that does not appear to go back far enough in time.
https://msdn.microsoft.com/en-us/library/mt490614.aspx

If you have an answer, please provide a relevant link that supports your response so that I can show my manager. Thanks.

Using Windows 10.
0
What does it mean to be "Always On"?
LVL 4
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

I use : to create  a new HWND

But requires the strike code for the window HWND chance his size

ex:  
bool HWND (chance size)
{
x = windowX
y= windowY

}


BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
{
   HWND hWnd;

   hInst = hInstance; // Store instance handle in our global variable

   hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW,
      CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);

   if (!hWnd)
   {
      return FALSE;
   }

   ShowWindow(hWnd, nCmdShow);
   UpdateWindow(hWnd);

   return TRUE;
}

Open in new window

0
i use,
hwndEdit = CreateWindowExW(WS_EX_CLIENTEDGE, TEXT("Edit"), NULL, WS_CHILD, 10, 10, 200, 150, hWnd, (HMENU) NULL,NULL,NULL );
ShowWindow(hwndEdit, SW_SHOW);

Open in new window


to add a text box of one line , now i want to add a multi line field.
2017-07-18--6-.png
0
Hallo,

When i, wane add a new EDIT child window which the user can type text from the keyboard.
a normal text box works, but when I challenge  CreateWindowExW( EDIT ..)

and  BUILD and run the program from my compute noting happens.

Do i miss the paint code or something.

//  Add a new TEXT imput box
//CreateWindow(TEXT("EDIT"),TEXT ("VALEU"), WS_VISIBLE | WS_CHILD | WS_BORDER ,10,10 ,200,25,hWnd, (HMENU) NULL,NULL,NULL );

// Add a new TEXT edit window

CreateWindowExW(WS_EX_CLIENTEDGE, TEXT("Edit"), NULL, WS_CHILD, 10, 10, 200, 25, hWnd, (HMENU) NULL,NULL,NULL );
			

Open in new window

Untitled.jpg
0
I have really problems to understand makefile and its rules.
I created a makefile that works perfect. Now I want to remove objects before compile but it do not work with rm -f *.o
I get always the message "Missing seperator. stop"

# Build
# /opt/rh/devtoolset-4/root/user/bin/
clean:
    rm -f *.o

root := /usr/share/doc/xsd/examples

include $(root)/build/cxx/rules.make
include $(root)/build/xsd/tree-rules.make

XSDValidator: XSDValidator.o 05_bxf2.o
05_bxf2.o: 05_bxf2.cxx 05_bxf2.hxx
XSDValidator.o: XSDValidator.cpp 05_bxf2.hxx

Open in new window


Any Idea what I do wrong? Without "clean: rm-f *.o" it works well. I also tried to use a tab before "rm"
But nothing helps. It looks like "rm" do not work in makefile?
0
Hello All, I need help. Badly!

We have a Mercurial repo that keeps out source code for the last year. Yesterday, and error popped up when compiling one of the solutions (see compile_error.jpg). I then ran other projects from that same solution that did compile, and I get the runtime error seen in the file runtime_error.jpg. I then went back to a repo from September 2016, and I get the exact same compile time and runtime errors.

I have tried this on 4 systems. All four systems are Windows Pro 64 bit. I'm using VS2013 C++.

I don't suspect the code itself nor the repository. I'm thinking a Windows 7 update, or a VS update, or ???

Please help. I need ideas.

Thanks, Brian
compile_error.jpg
runtime_error.jpg
0
Hi,
I compiled my first app on Linux and I get an error:
./XSDValidator: /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found (required by ./XSDValidator)

Open in new window


I made a check:
strings /usr/lib64/libstdc++.so.6 | grep GLIBCXX_3.4.1
GLIBCXX_3.4.1
GLIBCXX_3.4.10
GLIBCXX_3.4.11
GLIBCXX_3.4.12
GLIBCXX_3.4.13

Open in new window


And yes, it is not present. But how this error comes? I use gcc 5.1.0 is this the problem?

The software I compile use xerces-c as depency but this was installed with yum on my machine so I think it will not install things that link against a wrong libstdc++, right?

How to avoid this linking to an wrong libstdc++ ?
0
Hi, i wish if everyone is having a good day.
However i have an problem in mysql i would like to get the count of ids column in my table and plus 1 to the number how ever when i do like that it types +1 as string for example the result of counting was 3 it will add 3 to 1 like this 31 not 3+1=4 so i don't know how to solve this here's my code :

		String^ constring = L"datasource=...;port=...;username=...;password=..."; // Giving informations to the server
		MySqlConnection^ conDataBase = gcnew MySqlConnection(constring);
		MySqlCommand ^GetCount = gcnew MySqlCommand("Select Count(ID) from newdatabase.my_table;", conDataBase);
		MySqlDataReader^ myReader;
		MySqlCommand ^cmdDataBase;

		try {
			conDataBase->Open();
			myReader = GetCount->ExecuteReader();
			while (myReader->Read()) {
				int Got = myReader->GetInt32(0);
				cmdDataBase = gcnew MySqlCommand("Insert into newdatabase.my_table (ID) Values ('" + Got+1 + "');", conDataBase);//queries
			}
			myReader->Close();
			myReader = cmdDataBase->ExecuteReader();
		}
		catch (Exception ^Ex) {
			MessageBox::Show(Ex->Message);
		}
	}

Open in new window

0
Hi, Iam new to Linux and I have some problems compiling C++ code there.
A default "Hello World" software works fine. Compile and run well.

But now I want to add another code for XML and it looks like that I do something wrong in my makefile.

I use in my code:
# Build
root := /usr/share/doc/xsd/exmaples

include $(root)/build/cxx/rules.make
include $(root)/build/xsd/tree-rules.make

Open in new window


Bu the make/compiler give me the message that rules.make and other files cannot be found.
Can anyone help and explain what I did wrong?
0
try
	{
    //...................................................................
	 sql.Format("SELECT * INTO Sicherung_Thomas.dbo.LogBuch_%s FROM OMSDaten.dbo.LogBuch WHERE Zeitstempel>='%s' AND Zeitstempel<='%s'ORDER BY Zeitstempel ASC",str_tmp,str_loeschen_von,str_loeschen_bis);
    //...................................................................
	 _bstr_t bstrQuery(sql);
  	//Open the recordset object Tabelle 
    m_ptrRs->Open(_variant_t(bstrQuery),(LPCTSTR)m_strConnection, adOpenDynamic, adLockOptimistic, adCmdUnknown);
    //Get a pointer to the record-binding interface Coils
	if(FAILED(m_ptrRs->QueryInterface(__uuidof(IADORecordBinding),(LPVOID *)&m_piAdoRecordBinding)))     _com_issue_error(E_NOINTERFACE);
   
	}



	   //---------- Any erros? -------------
    	catch (_com_error &e)
		{
			//Display the error
        	GenerateError(e.Error(), e.Description());
		}
		//-----------------------------------

	


	// Do we have a valid pointer to the record binding?
	if(m_piAdoRecordBinding) m_piAdoRecordBinding->Release();       
	//Set the recordset pointer to NULL
	m_ptrRs = NULL;     
	//Shut down the COM environment
	::CoUninitialize();




//------------------------------------------------------------------------------------------------------------------------------------------------
void  CDatenbank_Anzeigen_Loeschen_Dialog::GenerateError(HRESULT hr, PWSTR pwszDescription)
{
	CString strError;
	//Format and display Error Message
	

Open in new window

0
Free Tool: Port Scanner
LVL 9
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Hi :)
This is my first post here and i hope to get an help :)
Anyway let's start with asking my question
my problem was that i only get 1 section name when using getprivateprofilesectionnames function
so i have searched a lot for an solution and i already found an solution but i don't actually understand how that works so could some one explain what's happening in the loop please ?

int main()
{
	char buffer[4096];
	GetPrivateProfileSectionNames(buffer, 4096, ".//SectionO.ini");

	char* Get = (char*)buffer;
	size_t length = 0;
	int nCnt = 0;
	while (*Get)
	{
		length = strlen(Get);
		cout << nCnt << Get << endl;
		nCnt++;
		Get += length;
		Get++;
	}
    return 0;
}

Open in new window


^ this is the code i have found can some one please explain what's happening in the loop ?
thanks guys.
0
Hi, does anyone have experience in this field? Where should we start as the beginners?

Many thanks as always!
0
Dear Team, can anyone show me where to begin with C++ in programming mobile apps?

I'm a newbie in C++ so if possible, pls give me links for the Beginners.

Many thanks in advance,
0
I am using Embarcadero C++ builder XE10.1 Berlin in an FMX application. How do I set the background colour in a TEdit control ?
0
I have a C++ builder code snippet below which I wish to use to display the cell values in a FMX TGrid component
The code gets called but the cell content is not displayed.
I suspect that this may be due to the TFillTextFlags not being initialised ? how do I do this or otherwise get the code to work ?
Also, how would I set the colour of the text being displayed by the fillText function ?

Thanks,

Roger

void __fastcall TForm1::Grid1DrawColumnCell(TObject *Sender, TCanvas * const Canvas,
		  TColumn * const Column, const TRectF &Bounds, const int Row,
		  const TValue &Value, const TGridDrawStates State)
{
	TValue v = Value;
	UnicodeString u = v.AsString();
	TFillTextFlags flags;
	Fmx::Types::TTextAlign ATextAlign;

	Canvas->Clear(claWhite);
	Canvas->FillText(Bounds,u,false,1,flags,Fmx::Types::TTextAlign(0x0));
}

Open in new window

0
I have a x64 shell extension for the context menu, which works fine. Only problem is; the icon does not show on the context menu. I have tried both InsertMenu and InsertMenuItem, but the icon does not show. Is there something else I have to do to make the icon appear in Windows Vista forward?
0
I created a x64 context menu shell extension in C++, which works fine when I right click a file or folder in the file list. But when I right click on a directory in the directory tree on the left Windows Explorer crashes, with no error details.

Any idea what can cause this to happen only in the directory tree?
0
I am currently looking for a way to detect if the "Pause Printing" option in the "See What's Printing" window is checked in Windows.

I've searched high and low, and looked into the Win32 native printing API (winspool) to see if there was such a detection available, but to no avail.

Is there anyone who has experience with a successful implementation of this detection?

I'm looking for a solution in either C/C++, or C#.
0
I have a C++ class that needs to get information from an oscilloscope for analysis. I have the code that issues the command to the o'scope and can see the o'scope getting the info. Here is that code:

void CbeLecroy::GetScaledWF(LCHAN channel, int numpoints, VARIANT* rvals)
{
	waveform.Attach(activeDSO->GetScaledWaveform(bCHANNEL[channel], numpoints, 0));
	rvals->parray = waveform.parray;
	float* pfloatVals;
	HRESULT hr;
	hr = SafeArrayAccessData(rvals->parray, (void**)&pfloatVals); // direct access to SA memory

	if (SUCCEEDED(hr))
	{
		long lowerBound, upperBound;  // get array bounds
		SafeArrayGetLBound(rvals->parray, 1, &lowerBound);
		SafeArrayGetUBound(rvals->parray, 1, &upperBound);

		fvec.clear();

		long cnt_elements = upperBound - lowerBound + 1;

		for (int i = 0; i < cnt_elements; ++i)  // iterate through returned values
			fvec.push_back(pfloatVals[i]);

		SafeArrayUnaccessData(rvals->parray);
	}
//	SafeArrayDestroy(psa);
}

Open in new window


The calling function looks like this:
    VARIANT rvals;
	comLecroy->GetScaledWF(channel, numpoints, &rvals);

Open in new window


When I breakpoint in the top function, I can see valid data in the loop:
		for (int i = 0; i < cnt_elements; ++i)  // iterate through returned values
			fvec.push_back(pfloatVals[i]);

Open in new window


However, when I exit the called function and return to the calling function, I get an exception. Any ideas why?

Thanks, Brian
0
Get HTML5 Certified
LVL 9
Get HTML5 Certified

Want to be a web developer? You'll need to know HTML. Prepare for HTML5 certification by enrolling in July's Course of the Month! It's free for Premium Members, Team Accounts, and Qualified Experts.

I want to write an application that can read/query Windows Explorer and list multiple files that are selected. My program will launch from the right-click context menu.

I have tried by reading the command line using GetCommandLine(), and that works fine. Except it launches a new instance of the program for each file selected.

Some guidance would be appreciated.
0
I'm programming Infineon TC29x Aurix Tricore Microcontroller based embedded system in 'C' language.  

Consider stack starting address 0x5000 0000.  The stack size is 0x2000.  

If I take current stack pointer minus 0x2000, will that create stack exception?  If yes, what might be 'C' or assembly language code that will achieve this?

My thought is if I subtract negative 0x2000 from current stack pointer or add 0x2000 to current stack pointer, I'll be outside stack and stack exception will occur ?

 I need to set program counter to illegal address, i.e. 0x00FF FFFC.  Can this be done with assembly language instructions?
 If yes, please instrument assembly language instruction that would set program counter to 0x00FF FFFC while code is running.
0
The below code is translated from C++ to C# but the row,  mask = -(crc & 1);  will not be compiled. Cannot implicitly convert type  'long' to 'uint'. If I change from uint to long I get the wrong result.  How can this be solved?

private uint crc32(byte[] message, int len)
{
      int i;
      int j;
      uint @byte;
      uint crc;
      uint mask;

            crc = 0xFFFFFFFF;
            for (i = 0; i < len; i++)
            {
                  @byte = message[i];
                  crc = crc ^ @byte;
                  for (j = 7; j >= 0; j--)
                  {
                        mask = -(crc & 1);
                        crc = (crc >> 1) ^ (0xEDB88320 & mask);
                  }
            }
            return ~crc;
}
0
I have installed a C++ add-on to Visual Studio that enable code to be developed for Particle Electron and Photon devices. I have an issue that I believe is more related to Visual Studio than the plug in.
First I installed the plug-in on my home PC (running Windows 10, 64 bit OS) and VS 2015. All worked fine.
I then copied the same steps on my office PC (also running Windows 10, 64 bit OS) and VS 2015 but when I attempt to create a project I get no option to enter solution name or location and the checkbox to create a directory is also gone. When I proceed, I get a project but no solution and then I can never save the project. I can only exit VS if I discard the project.
What-is-should-look-like.JPG
what-is-does-look-like.JPG
0
Hello Experts, I have a routine in a C++ application the creates a named  shared memory view of a structure:

struct TEST_STRUCT
{
	long 			tnum;
	unsigned long 	pass_count;
	unsigned long 	fail_count;
	unsigned long 	try_count;
	double 			sum_result;
	double 			sumsq_result;
	double 			min;
	double			max;
	unsigned 		histogram[HISTOGRAM_SIZE];
	bool 			tested;
	bool 			passed;
	double 			last_result;
};

Open in new window


The C++ application puts data into the named shared memory structure and then sets a windows named event for another process to read the same structure. That other process was written in C++ and works fine. I now need to do the same thing as the reading process, but in c#. Can you tell me how to create a TEST_STRUCT variable in c# that can be used to access the C++ named shared memory?

Thanks, Brian

Windows 7 Pro
VS2013
0
the array has series of numbers Need to find all pairs in the array using a hash table
integers ...
0

C++

57K

Solutions

24K

Contributors

C++ is an intermediate-level general-purpose programming language, not to be confused with C or C#. It was developed as a set of extensions to the C programming language to improve type-safety and add support for automatic resource management, object-orientation, generic programming, and exception handling, among other features.