|
Well now,..., I did not fully understand you first post. Now I presume that module X can be compiled in debug mode while everything else is in release mode. If true, just how is that done?
Thanks for your time
If you work with telemetry, please check this bulletin board: http://www.bkelly.ws/irig_106/
|
|
|
|
|
Only time I've had to do it was when I didn't have the source to a third-party dll. You should be able to have the rest of the application be debug and your third-party dlls be release mode with no issues (obviously you can't debug the inner working of those dlls but they're still loaded and working).
With that said though... it's probably better practice to run the whole thing in debug or release (a lot can go wrong with the mixed assemblies).
modified 11-Mar-13 14:03pm.
|
|
|
|
|
Hi everybody I need some professional help from experienced people. I am writing a program in C++ about a game. I have to specify a class Questions with attributes question, answers and difficulty. In the program i should have methods add, edit, select, search, print and remove. The problem that i have is that i have to work dynamically with these questions and when i choose from the menu save, just then to save everything into the file. So far i have ideas for everything except what kind of container to use?? I thought that i can use "map" but the key ( this should be the number of question) is const and if i delete a question the keys after that will remain the same. I need when i delete a question this integer ( question number) to decrease with 1. Can you give me an advise what kind of container to use and if i need to put question number as an attribute into the class.
Thank you in advance for the help
|
|
|
|
|
Perhaps you should look at array or, considering you mention a dynamic requirement vector. You mention the number of the question needing to decrease by 1 if you delete a question. Map uses keys that remain the same i.e. don't decrease by 1 whilst vector, for instance will accomodate this better. I'm assuming that, say, if you delete question 5 then the fact that you want what was question 6 to now become question 5, question 7 to become 6 etc. With a map you could keep the keys 1,2,3,4,6,7,8.
|
|
|
|
|
In the above scenario u can use vector which would maintain the count of questions.Second thing if u want to provide some uniqueness to the question I think u should take a timestamp as variable in your question class which is updated when u create a question and will be overwritten if u modify that question. Thus ur count and uniqueness will remain intact.
|
|
|
|
|
Windows XP Pro, Visual Studio 2008, C++, MFC
Start an application in the debugger and step over:
unsigned int length = 0;
length = strlen( some_char_array );
When hovering over the variable the debugger will not show a value for length. It does show the text of some_char_array, passed in as an argument. Quick watch claims that length is not defined. A breakpoint was set in the constructor of that object and it is being called. The same problem exists there also.
In the below fragment neither the if or the else is executed:
if( length < SOME_CONSTANT )
{ X = 1; }
else
{ X = 2; }
What have I done that will cause the debugger to not show variables?
EDIT: To be more precise the quickwatch says:
CXX0030 Error: expression cannot be evaluated.
Thanks for your time
modified 13-Feb-13 9:44am.
|
|
|
|
|
It is possible that the executable you are debugging is not up to date with the source code. Try a full rebuild of your project.
|
|
|
|
|
The computer was rebooted, same results. On the above suggestion, did a Clean and Rebuild, same results. I will try another reboot and clean and if sucessful, will post the results. Otherwise, assume no change.
(The working computer has no internet connection and is in another room)
I also noticed:
m_hour = 0;
m_minute = 0;
m_second = 0;
All are declared a member variables. The debugger skipped over m_hour and visited m_minute and m_second. Very curious.
EDIT
After a reboot and after deleting the *ncp and *.pch files, the results were the same. Another Clean and Build had no effect.
THEN
I realized the project was set to build the realease version. (That is displayed in the toolbar) After changing that to debug, everything seems normal again. I could whine about this, that, and the other, and how it SHOULD work but that is not going to change anything. The end result is almost two hours expended learning this little lesson because I did not notice all the indicators.
Thanks for taking the time to post.
Thanks for your time
modified 13-Feb-13 10:10am.
|
|
|
|
|
Yeah, release version isn't built with debug information so the debugger doesn't work right.... You can however, mix debug and release versions of things to debug the portions that are built with debug information hence Visual Studio allowing you to do this... So, it's really working as it should be.
|
|
|
|
|
bkelly13 wrote: I realized the project was set to build the realease version. Yeah, we've all done that once or twice. The thing with the Release build is that variables can get optimized away that will always show up in the Debug build. BTW I don't think that rebooting would have made any difference to the situation.
|
|
|
|
|
Sorry if this is not the good place where I put my question but please I have an urgent problem.
I have a MFC application which create mdb and mdw files , I build it into two platform:
1) 32 bit : its include odbc library and it works on both OS 32 and 64 (as Win 7)
2) 64 bit : this version not works and it says that cant get the driver to create mdb and mdw files.
It seems that cant get the driver ODBC 64 bit and after a long search it seems also that there is no version 64 for driver for mdb files
Have you any idea about this ? and how can I have a 64 bit version of my application which run normaly and without this type of problem ?
|
|
|
|
|
khaliloenit wrote: there is no version 64 for driver for mdb files That is true, so I'm afraid you have to keep it as 32 bit.
|
|
|
|
|
template <class t=""> class MyTemplate1
{
T* pT = static_cast<t*>(this);
LPCSTR typname1= ...
LPCWSTR typnameW= ...
}
class MyCls : public MyTemplate1<mycls>
{
};
i use ATL (but I am new to it..) how can i get the name "MyCls" in the template..
i want use it for debug log..
Thank you
|
|
|
|
|
|
hm this doesnt help me...
can you please just answer the question if you know it
thanks Frank
|
|
|
|
|
I try to create sys dsn from my C++ application
but i have always the same error:
The installation routines ODBC Microsoft Access Driver (*. Mdb) are not found. Please reinstall the driver.
I have Office 2007 installed but always error
For example this a VB test which return failed:
Public Class Form1
Private Declare Function SQLConfigDataSource Lib "ODBCCP32.DLL" (ByVal hwndParent As Integer, ByVal ByValfRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Integer
Private Const ODBC_ADD_SYS_DSN As Short = 4
Private Const vbAPINull As Integer = 0
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CreateSystemDSN()
End Sub
Public Sub CreateSystemDSN()
Dim ReturnValue As Integer
Dim Driver As String
Dim Attributes As String
Driver = "Microsoft Access Driver (*.mdb)"
Attributes = "SERVER=SomeServer" & Chr(0)
Attributes = Attributes & "DESCRIPTION=New DSN" & Chr(0)
Attributes = Attributes & "DSN=DSN_TEMP" & Chr(0)
Attributes = Attributes & "DATABASE=pubs" & Chr(0)
ReturnValue = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, Driver, Attributes)
If ReturnValue <> 0 Then
MsgBox("DSN Created")
Else
MsgBox("Create Failed")
End If
End Sub
End Class
Thank you.
|
|
|
|
|
I have just gone from Visual C++ 6.0 to Visual Studio 2012. So far it is working well, I have manged to transfer my application over, albeit with some difficulties. But the program creates this big SQL Server Compact Edition, which I don't need. My application is not a database tool. How do I remove it?
|
|
|
|
|
How does it create this unless you have added it to the project?
|
|
|
|
|
Richard MacCutchan wrote:
How does it create this unless you have added it
to the project?
Well, I haven't. The file is totally new to me. It just pops up.
|
|
|
|
|
I assume then that you are talking about the file with the same name as the solution. This is created and used by Visual Studio that contains information about the solution and it's references.
|
|
|
|
|
Hi,
i writing a code in c language in load runner to upload a file into the current directory using c.I am getting an error
"operands of = have illegal types `pointer to char' and `int'"
Below is my code:-
char *current_dir = getcwd();
char *filename = "current_dir:\\EUR_PR_01302013.txt";
long file_stream;
if ((file_stream = fopen(filename, "a+")) == NULL) //open file in append mode
{
lr_output_message("Unable to create %s", filename);
return -1;
}
Any kind of help/suggestion will be appreciated.
regards,
raghvendra panda
|
|
|
|
|
Which line gives the error?
And please use <pre> tags around your code.
|
|
|
|
|
You have to format the filename string.
Also need to allocate memory to it.
char filename[1024];
sprintf(filename, "%s\\EUR_PR_01302013.txt", current_dir);
|
|
|
|
|
Environment Windows XP and 7, Visual Studio 2008, C++.
Experience level: novice with TCP/IP, but do have the application working with CAsyncSocket.
The message application receives telemetry data from some hardware (arrives fast and furious), processes it and dispatches the results to a display device via TCP/IP. It sends the data to the client but does not receive from the client.
Setup: the TCP “Manager” is started by the main application and it listens for the client. On connect, it creates the “Sender” that does all the sending.
Question: what is the best, read that simple and maintainable, way for the manager to get the Sender pointer to the main application so it can use the Sender? When the client closes the connection, how is the application informed of that?
Tentative proposal: the application provides the Manager with a pointer to itself. When the connect is made the Manager calls an application method such as
Set_TCP_Sender_Pointer( C_Sender_Class *new_sender_pointer );
The Manager can pass the pointer (to the main application) to the Sender on creation. When the Sender gets a close from the client, it calls the same method using a NULL for the argument. This makes the application aware there is no Sender. Then the Sender exits. (There is only one thread so I think there is no concern about the application using a pointer to a non-existent Sender.)
I am pretty sure that will work, but if you had to pick up on this project, would it be easy to understand and maintain? Presume you are not an expert with TCP/IP in the Microsoft world.
I am open to alternative suggestions.
Thanks for your time
|
|
|
|
|
After writing the OP I outlined the process with all the steps then began to implement.
I have started using a common directory for re-usable code. In order for the Manager to call a method in its creator it must know the name of the owner's class. To do that I added a forward declaration in the Manager.
However, this means that when the class is re-used, and the owner has a different name, the Manager must be changed.
There is another indicator this is a bad practice. After the forward declaration in the dot H file, the dot CPP file needs to reference the dot H file of the owner. The common code resides in another directory and it cannot find the central code of the main project unless it is specifically spelled out. Then, if the project is moved or re-name, the common code must change.
There may be a way to do this automatically using directive and path names within Visual Studio. But I now think that even if that can be done it would be miss-guided.
Conclusion:
A utility class can call "down" the heiarchy to objects it creates, but should not call up to its owner. While the concept of it calling up may make the owner code neater, it represents an inversion of authority. (Regardless of how the methods are name, a call up in an inversion.)
Problems remain:
The main application uses pointers into the lower level objects to accomplish its tasks. How does it become aware that the lower level needs to exit, or maybe even has already exited.
Controlled exits:
When the TCP sending function detects that the client has closed the connection it does not exit right away. It waits until the upper level code calls the method to send the data. Then the lower level returns an error code stating that the data has not been sent and that the object is exiting.
Uncontrolled exits:
I generally do not like exceptions, but this appears to be a time when an exception is warranted. When the lower level must terminate unexpectedly, then an exception could work its way back to the upper level and the exception handler can NULL the pointer.
Thanks for your time
|
|
|
|