(APIWrapper.obj) : fatal error LNK1103: debugging information corrupt; recompile module
Visual C++ 2005 builds a release copy but not a debug.
After days of testing and trying a number changes we have not been successful in findijng the problem. There seems to be an issue with the 2005 linker. The same library compiled with VS 2008 works with VS 2002 and VS 2003, 2005 is the only problem.
We are running Beta SP1 for Visual 2008 SP1 for 2005 and the latest Platform SDK 6.1
O/S is Windows XP SP3
Anyone else have similar problems?
Thanks in advance for any help!
Cheers!
fatal error LNK1103: debugging information corrupt; recompile module
OpenGL: VBO and a broken Graphics Card
It compiles fine and seems running well. However, I noticed on the taskmanager that the program runs at 50% CPU usage. Its just a simple triangle, nothing else. I was expecting it to be of 0% because all of other programs I created in glfw3 runs on 0% when idle. I know that V-SYNC in glfw3 is set true by default, but still I add this line of code to ensure
glfwSetInterval(GL_TRUE); //sets V-SYNC onbut still nothings changed.
After messing with the `test_vs.glsl` (I think this has nothing to do with the problem):
code I changed:
from
#version 400 in vec3 vp; void main () { gl_Position = vec4 (vp, 1.0); }to
#version 400 in vec2 vp; void main() { gl_Position = vec4 (vp, 0, 1.0); }And changed attributes of vertex in .cpp code to 2D.
Running several times the `Hello Triangle` program again, computer stops and hang a bit ---> Then**CRAASSH**. The graphics card is broken! (literally ouch). The computer shutdowns itself, and I try rebooting it again, I got a screen with full of random lines displaying and fail to continue on desktop.
I don't have much of the information about the graphics card but glew saysGeForce 7300 GT/PCI/SSE2/3DNOW! and running on Windows XP withOpenGL v2.1 support according to glew.
Some of the extensions I added:
glfwWindowHint(GLFW_SAMPLES, 4); glfwWindowHint(GLFW_OPENGL_CORE_PROFILE, 2); glewExperimental = GL_TRUE; //And I add the prefix ARB to any function related to vbo
I suspect this is due to lack of OpenGL extensions support check. But, is that so really the problem? Is it the simple program or other? If so, why would they let this to happen?
Console application task doesn't close
When I run a program (code is below) on Visual studio express, it executes fine (a window opens with the output and closes), but then VS freezes and I have to terminate it using the task manager, then it restarts and I can't run the project again - I get a LNK error. Turns out that the console application process (ConsoleApplication.exe) is still open! I can see it in the "processes" tab in the task manager, but trying to terminate it doesn't work. Only rebooting the computer.
I found online someone claiming that a Microsoft update KB978037 to Windows (I have Windows 7) could have caused this, but I can't find such an update on my machine (I looked in control panel-->uninstall programs-->view installed updates).
I am very frustrated with this, does anyone have any idea what could be the cause of this?
#include <stdio.h> int main() { int i; int sum=0; for (i = 1; i < 1000; i++) { if (i % 3 == 0 || i % 5 == 0) { sum += i; } } printf("%d", sum); return 0; }
tips from vivion
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Expenses { class Expense { private string[] categories = { "Travel", "Entertainment", "Office" }; private static Random rand1 = new Random(); public string Category { get; set; } public decimal Cost { get; set; } public DateTime Date { get; set; } public Expense() { Category = categories[rand1.Next(0, 3)]; decimal i = (decimal)rand1.Next(1, 10001)/100; Cost = i; Date = DateTime.Today.AddDays(-rand1.Next(0, 32)); } public Expense(string category, decimal cost, DateTime date) { this.Category = category; this.Cost = cost; this.Date = date; } public override string ToString() { return Category + " " + String.Format("{0:C}", Cost) + " on " + Date.ToShortDateString(); } } }
tips from jk
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace BookList { class Book { public string Author { get; set; } public string Title { get; set; } public decimal Price { get; set; } public Book(string author, string title, string price) { this.Author = author; this.Title = title; this.Price = Convert.ToDecimal(price); } public override string ToString() { return Author + " " + Title + " €" + Price; } public string FileWriteFormat() { //charles dickens,hard times,10 return Author + "," + Title + "," + Price; } } }
libmysql.lib missing and Visual C++ 2008 Express
Hi Mate,
I spent a lot of time to search for solution for the following problem.
I just install VC++ 2008, then try to connect to MySQL Server 5.6. I can build the application successfully. But when I run it I get an error saying that.
The program can't start because libmysql.dll is missing from your computer. Try reinstalling the program to fix this problem.
I checked the Additional Library Directories, and Additional Dependencies carefully.
Thank you very much.
Here is the code
#include <stdlib.h>#include <iostream>
#include <sstream>
#include <stdexcept>
/* uncomment for applications that use vectors */
/*#include <vector>*/
#include "mysql_connection.h"
#include <cppconn/driver.h>
#include <cppconn/exception.h>
#include <cppconn/resultset.h>
#include <cppconn/statement.h>
#include <cppconn/prepared_statement.h>
#define EXAMPLE_HOST "127.0.0.1"
#define EXAMPLE_USER "vfarunner"
#define EXAMPLE_PASS "vfm123$%^"
#define EXAMPLE_DB "wh"
using namespace std;
int main(int argc, const char **argv)
{
string url(argc >= 2 ? argv[1] : EXAMPLE_HOST);
const string user(argc >= 3 ? argv[2] : EXAMPLE_USER);
const string pass(argc >= 4 ? argv[3] : EXAMPLE_PASS);
const string database(argc >= 5 ? argv[4] : EXAMPLE_DB);
cout << "Connector/C++ tutorial framework..." << endl;
cout << endl;
cin.get();
try {
sql::Driver* driver = get_driver_instance();
std::auto_ptr<sql::Connection> con(driver->connect(url, user, pass));
con->setSchema(database);
std::auto_ptr<sql::Statement> stmt(con->createStatement());
// We need not check the return value explicitly. If it indicates
// an error, Connector/C++ generates an exception.
stmt->execute("CALL add_country('ATL', 'Atlantis', 'North America')");
} catch (sql::SQLException &e) {
/*
MySQL Connector/C++ throws three different exceptions:
- sql::MethodNotImplementedException (derived from sql::SQLException)
- sql::InvalidArgumentException (derived from sql::SQLException)
- sql::SQLException (derived from std::runtime_error)
*/
cout << "# ERR: SQLException in " << __FILE__;
cout << "(" << __FUNCTION__ << ") on line " << __LINE__ << endl;
/* what() (derived from std::runtime_error) fetches error message */
cout << "# ERR: " << e.what();
cout << " (MySQL error code: " << e.getErrorCode();
cout << ", SQLState: " << e.getSQLState() << " )" << endl;
return EXIT_FAILURE;
}
cout << "Done." << endl;
return EXIT_SUCCESS;
}
Query about list control selection and actions
Hi,
I have to create a list control in my dialog based application and I did that. Now I want to make the list control as, "I will select a row (list) then that will be highlighted and I will right click on the another list to get the popup menu. This time, the first selected list will be lighten the highlighted color and the new one will be highlighted with the dotted lines as showed in the attached image and if I select any action from the popup menu then that should be done for the second selected list".
This image is take from the outlook mail list.
Is this possible in List control?
Kindly provide your valuable suggestions
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'ATL::CComPtr' (or there is no acceptable conversion)
Hi
I am migrating my application from vc++ 0.6 to vc++ 2013
I am sending th epart of code and highlighting the error line
===========================CODE=========================
// Get the recordset for the given layout item
// @param spItem IAudiDataLayoutItem pointer
// @param roIterator
// @returns recordset pointer
ADO::_RecordsetPtr CCustomImportBase::GetRecordset(JOBTools::IAudiDataLayoutItemPtr spItem, NAME2RECORDSET::iterator &roIterator)
{
USES_CONVERSION;
ADO::_RecordsetPtr spRS;
VARIANT_BOOL bIsChildRS = spItem->field_odbc_is_join;
_bstr_t szTablename = (VARIANT_TRUE == bIsChildRS ? spItem->field_odbc_table : MAIN_RECORDSET_NAME);
roIterator = m_oRSMap.find(OLE2CT(szTablename));
if ( roIterator != m_oRSMap.end() )
{
spRS = static_cast<ADO::_Recordset *>(roIterator->second.m_spRecordset);
} else
{
// table not yet found in buffer ==> create new entry
// get the child recordset from the parent (currently only one hierarchy level)
if ( false == !m_spRecordset && bIsChildRS )
{
spRS = m_spRecordset->Fields->Item[szTablename]->Value;
} else
{
spRS = m_spRecordset; //error
}
roIterator = m_oRSMap.insert(NAME2RECORDSET::value_type(OLE2CT(szTablename), CRecordsetMap(static_cast<ADO::_Recordset *>(spRS)))).first;
ATLASSERT(roIterator != m_oRSMap.end());
}
return spRS;
}
=========================CODE=====================================
Can any one find out the solution
Thanks Ankush
error C2440: 'initializing' : cannot convert from 'ATL::CComPtr' to '_com_ptr_t'
Hiii
I am migrating my application from vc++ 0.6 to vc++ 2013, iam facing the following error in one of the cpp file
The part of the code is given below and i have highlited the error line too
===================CODE===========================
Handle the recordset in the recordset map if the next physical record is requested
// @param ret VARIANT_TRUE if there are one or more active recordsets in the map
// @returns HRESULT
HRESULT CCustomImportBase::HandleRSMapForNextPhysicalRecord(VARIANT_BOOL *ret)
{
*ret = VARIANT_FALSE;
NAME2RECORDSET::iterator oIte;
for ( oIte = m_oRSMap.begin(); oIte != m_oRSMap.end(); ++oIte )
{
tstring szName = oIte->first;
if ( szName == MAIN_RECORDSET_NAME )
{
// the main RS is only in the first round active
oIte->second.m_bIsActive = false;
} else
{
// move to next record in child recordset
if ( oIte->second.m_bIsActive && false == !oIte->second.m_spRecordset )
{
ADO::_RecordsetPtr spRS = oIte->second.m_spRecordset; //error
if ( VARIANT_FALSE == spRS->adoEOF )
{
spRS->MoveNext();
}
oIte->second.m_bIsActive = (VARIANT_FALSE == spRS->adoEOF);
if ( oIte->second.m_bIsActive )
{
// great, we have found a active record
*ret = VARIANT_TRUE;
}
}
}
}
return S_OK;
}
========================CODE===========================
Please anyone help me through this
Thanks Ankush
Unable to receive data through serial port
Hi All,
Currently I try to write a serial port communication in VC++ to transfer data from PC and robot via XBee transmitter. But after I wrote some commands to poll data from robot, I can not receive anything from the robot (the output of buffer is empty.).
One problem may be that I have no idea how big of data I will receive from robot. So I am not sure whether I set the size of "buffer" to 257 is correct. In addition, the output of "error" is always 1. Because my MATLAB interface works,
so the problem should happen in the code not the hardware or communication. Would you please give me help?
P.S (1) I have called GetLastError and err=WriteFile(...), they showed that no error happen in WriteFIle or ReadFIle.
(2) The communication require that Flow control: "Hardware" for XBee, "None" for USB cable adapter. Would you please tell me whether I set the flow control correctly in the code?
#include "StdAfx.h" #include <iostream>; #define WIN32_LEAN_AND_MEAN //for GetCommState command #include "Windows.h" #include <WinBase.h>; using namespace std; int main(){ char init[]=""; HANDLE serialHandle; // Open serial port serialHandle = CreateFile("\\\\.\\COM8", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); // Do some basic settings DCB serialParams; DWORD read, written; serialParams.DCBlength = sizeof(serialParams); if((GetCommState(serialHandle, &serialParams)==0)) { printf("Get configuration port has a problem."); return FALSE; } GetCommState(serialHandle, &serialParams); serialParams.BaudRate = CBR_57600; serialParams.ByteSize = 8; serialParams.StopBits = ONESTOPBIT; serialParams.Parity = NOPARITY; //set flow control="hardware" serialParams.fOutX=false; serialParams.fInX=false; serialParams.fOutxCtsFlow=true; serialParams.fOutxDsrFlow=true; serialParams.fDsrSensitivity=true; serialParams.fRtsControl=RTS_CONTROL_HANDSHAKE; serialParams.fDtrControl=DTR_CONTROL_HANDSHAKE; if (!SetCommState(serialHandle, &serialParams)) { printf("Set configuration port has a problem."); return FALSE; } GetCommState(serialHandle, &serialParams); // Set timeouts COMMTIMEOUTS timeout = { 0 }; timeout.ReadIntervalTimeout = 3; timeout.ReadTotalTimeoutConstant = 3; timeout.ReadTotalTimeoutMultiplier = 3; timeout.WriteTotalTimeoutConstant = 3; timeout.WriteTotalTimeoutMultiplier = 3; SetCommTimeouts(serialHandle, &timeout); if (!SetCommTimeouts(serialHandle, &timeout)) { printf("Set configuration port has a problem."); return FALSE; } //write packet to poll data from robot WriteFile(serialHandle,">*>p4",strlen(">*>p4"),&written,NULL); //check whether the data can be received char buffer[257]; if (!ReadFile(serialHandle,buffer,sizeof(buffer),&read,NULL)) { printf("Reading data to port has a problem."); return FALSE; } int t; bool error; DWORD numberOfBytesRead=0; DWORD err = GetLastError(); for (int jj=0;jj<10;jj++) { error=ReadFile(serialHandle,LPVOID(buffer),255,&numberOfBytesRead,NULL); buffer[numberOfBytesRead]=0; cout<<buffer<<endl; cout<<error; } CloseHandle(serialHandle); return 0; }
Serial communication not working. ReadFile() has a problem.
Hi All,
Currently I try to use serial communication (XBee) to communicate between the PC and the robot via vc++. I have done the same thing via MATLAB. So there is no problem
for the hardware.
After I write commands to poll data, I can not receive any data. The interface requirement is:
Baudrate: 57600Flow control: ”Hardware” for XBee, ”None” for
USB cable adapter
Databits: 8, 1 startbit, 1 stopbit, no parity
Please give me your help.
// This is the main DLL file.
#include "StdAfx.h"
#include <iostream>
#define WIN32_LEAN_AND_MEAN //for GetCommState command
#include "Windows.h"
#include <WinBase.h>
using namespace std;
int main(){
char init[]="";
HANDLE serialHandle;
// Open serial port
serialHandle = CreateFile("\\\\.\\COM8", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
// Do some basic settings
DCB serialParams;
DWORD written;
DWORD read;
char buffer[1];
char data[103];
int t=0;
int jj=0;
//serialParams.DCBlength = sizeof(serialParams);
if((GetCommState(serialHandle, &serialParams)==0))
{
printf("Get configuration port has a problem.");
return FALSE;
}
GetCommState(serialHandle, &serialParams);
serialParams.BaudRate = CBR_57600;
serialParams.ByteSize = 8;
serialParams.StopBits = ONESTOPBIT;
serialParams.Parity = NOPARITY;
//set flow control="hardware"
serialParams.fOutX=false;
serialParams.fInX=false;
serialParams.fOutxCtsFlow=true;
serialParams.fOutxDsrFlow=true;
serialParams.fDsrSensitivity=true;
serialParams.fRtsControl=RTS_CONTROL_HANDSHAKE;
serialParams.fDtrControl=DTR_CONTROL_HANDSHAKE;
//suggest to apply
//serialParams.fBinary=true;
//serialParams.fParity=true;
if (!SetCommState(serialHandle, &serialParams))
{
printf("Set configuration port has a problem.");
return FALSE;
}
GetCommState(serialHandle, &serialParams);
// Set timeouts
COMMTIMEOUTS timeout = { 0 };
timeout.ReadIntervalTimeout = 100;
timeout.ReadTotalTimeoutConstant = 100;
timeout.ReadTotalTimeoutMultiplier = 100;
timeout.WriteTotalTimeoutConstant = 100;
timeout.WriteTotalTimeoutMultiplier = 100;
SetCommTimeouts(serialHandle, &timeout);
if (!SetCommTimeouts(serialHandle, &timeout))
{
printf("Set configuration port has a problem.");
return FALSE;
}
bool err1;
//clear the buffer
PurgeComm(serialHandle,PURGE_RXCLEAR);
//write >*>p0x0004 to poll IMU_CalcData from robot
BYTE test[]={62,42,62,112,4};
WriteFile(serialHandle, test,5,&written,NULL);
do {
data[jj]=0;
err1=ReadFile (serialHandle,&data[jj],1,&read, NULL);
cout<<read;
cout<<(int)data[jj];
cout<<err1;
cout<<"\n";
if (read!=0)
{
jj++;
}
t++;
Sleep(10);
} while (t<100);
CloseHandle(serialHandle);
return 0;
}
File Upload(Web Based Internet Explorer) need Code
Hi
I want to select a file using fileupload through code (with out human invervention).
when i run the code fileupload control should automatically pick the file from specific path.
advance thanks.
hi
I believe this to be a bug in VS2013
According to 12.3.1/2 this should compile in VS2013
struct A { A() = default; explicit A(A const&) {} }; int main() { A a; A b = static_cast<A>(1); A c = A(1); }
What is " ^% "
Hey kids, what is the meaning of this "^%" [hat and percentage] symbol for the .net?
It is very hard to bing this symble, not even in here I could find any reference to it. Where can I find info about it?
TIA
Worry is a misuse of imagination :)
MFC 2010 connect with SQL sever 2008
Hi all
I am a developer about Visual C++ 2010.
I develop many applications which are used MFC 2010 library
I want connect MFC2010 and SQL sever 2008 but I don't find any the way to implement this problem.
I want a demo or some document for my problem
Can the member of forums support for me.
Thank you so much
____________________
damme88
IcmpSendEcho2 broken in Windows 2008 Server?
Testing some existing code with Windows 2008 Server. IcmpSendEcho2 seems to crash on Windows 2008 Server.
I tried the code sample from the SDK and I saw the same issue (see code below). The exact sample from the SDK (using the synchronous call) works fine but as soon as I try to use an asynchronous call, it crashes. The same code works perfectly on WinXP. The code crashes right after the callback returns...
This just does not make sense.
Could anyone confirm that this is an existing bug or let me know what I am doing wrong.
Test code:
#define PIO_APC_ROUTINE_DEFINED
#include <winsock2.h>
#include <iphlpapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <winternl.h>
#include <icmpapi.h>
PIO_APC_ROUTINE GotIt(PVOID param, PIO_STATUS_BLOCK IoStatusBlock, ULONG Reserved)
{
printf("GOT IT!\n");
return NULL;
}
int __cdecl main(int argc, char **argv)
{
// Declare and initialize variables
HANDLE hIcmpFile;
unsigned long ipaddr = INADDR_NONE;
DWORD dwRetVal = 0;
DWORD dwError = 0;
char SendData[] = "Data Buffer";
LPVOID ReplyBuffer = NULL;
DWORD ReplySize = 0;
// Validate the parameters
if (argc != 2) {
printf("usage: %s IP address\n", argv[0]);
return 1;
}
ipaddr = inet_addr(argv[1]);
if (ipaddr == INADDR_NONE) {
printf("usage: %s IP address\n", argv[0]);
return 1;
}
hIcmpFile = IcmpCreateFile();
if (hIcmpFile == INVALID_HANDLE_VALUE) {
printf("\tUnable to open handle.\n");
printf("IcmpCreatefile returned error: %ld\n", GetLastError());
return 1;
}
// Allocate space for at a single reply
ReplySize = sizeof (ICMP_ECHO_REPLY) + sizeof (SendData) + 8;
ReplyBuffer = (VOID *) malloc(ReplySize);
if (ReplyBuffer == NULL) {
printf("\tUnable to allocate memory for reply buffer\n");
return 1;
}
dwRetVal = IcmpSendEcho2(hIcmpFile, NULL, (PIO_APC_ROUTINE)GotIt, NULL,
ipaddr, SendData, sizeof (SendData), NULL,
ReplyBuffer, ReplySize, 1000);
SleepEx(5000, TRUE);
return 0;
}
I tried to use the latest SDK but still no luck.
Thanks.
Accelerator table in dialog box
I'm programming with the Win32 API, not MFC.
I need to use an accelerator table within a modal dialog. Is there any way of doing this ?
Binary Search in Multi Dimensional Vector
Need help making a simple log
Hello,
I am new to both C++ and the visual C++ environment. I am trying to create a log in which there is a drop down box with defined dates in it, when one of the dates is selected a text box is filled with a description about what happened on that date, this description will vary depending on the selected date and also a button would be required which when selected would load up a PDF document of the relevant date log.
I have attempted to do this by creating a combo box list and setting an event as shown:
private: System::Void comboBox1_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e){ String^ comboVal=comboBox1->Text; if(comboVal="01-Jan-2014") textBox1->Text="01/01/14 description..."; else if(comboVal="03-Dec-2013") textBox1->Text="03/12/13 description..."; else textBox1->Text="no log for this date"; }
But every time I run this it only looks at the first IF statement and no matter what I select the result in the text box is "01/01/14 description...".
I am also a bit confused about how to attach PDF's to the button, I understand that the button will also have a series of IF statements similar to the text box but how would I define the hyperlink and when compiled will I have to keep the executable file (.exe) with the PDF's? because I plan on using this on many different computers and it would be handy if I there was a way of just having a single executable file rather than a folder with many PDF's.
I have been searching and experimenting with this for a while now therefore, any help at all with this will be greatly appreciated. Thank you.
DirectShow webcam recording
I need to use DirectShow (C++) for recording a webcam and saving the data to a file.
I really don't know how DirectShow works, and this is a "stage" (working experience), and at school we didn't study this argument.
I think the best way to implement this could be:
- List the video devices connected to the computer
- Selecting the correct camera (there will be only one)
- Retriving the video
- Saving it to a file
Now there are two problems:
- Where can I find a good reference book or how do I start?
- The saved video shouldn't be too big, does DirectShow provide a way to compress it?
I won't use OpenCV because sometime it doesn't work properly (It doesn't find the camera). Are there any high level wrapper that could help?
EDIT: the program won't have a window, it will run in background called by a dll.