|
|
Hello
I'm debugging code created using another programming environment (called AD model builder or ADMB) that generates C++ code. To do this, I have to make the following changes in the project settings:
- Add program_name.tpl to your project. Where program_name.tpl is some sort of template (not in the sense of C++ templates) that has the original code that is then translated to C++.
- Click on program_name.tpl then on the Project menu, choose settings, in the Custom Build tab, Commands window, add:
C:\ADMB\BIN\TPL2CPP.EXE $(InputName)
move $(InputName).htp $(WkspDir)
In the Output window put:
$(InputName).cpp
TPL2CPP.EXE is the aplication that translates the ADMB template into C++.
(a) When creating the new project create a blank 32 bit Windows console application in the folder where the source files are.
(b) In Project/Settings/C++/Code generation, ensure that the runtime library is Debug single-threaded.
(c) In Project/Settings/C++/Preprocessor/Preprocessor definitions add __MSVC32__ to the list so the list is: WIN32,_DEBUG,_CONSOLE,_MBCS,__MSVC32__
(d) In Project/Settings/ C++/Preprocessor/Additional include directories add the folder where the ADM include files are, as well as the source folder for the current program e.g. c:\admodel\include,c:\admodel\examples\kalman-filter
(e) In Project/Settings/Link/General delete the Object/library models shown and add the ADM ones: admod32.lib adt32.lib ads32.lib
(f) In Project/Settings/Link/Input add the ADM library folder - e.g. c:\admodel\lib
Then, while debugging the code, if I have to make changes to the program_name.tpl file and try to recompile the resulting C++ it compiles OK but the linker can't access the exe file for modification because apparently is still in use even when I stop debugging clicking on the "stop debugging" button.... Then I tried deleting the exe file but got a message that it is in use by another application but it doesn't show up neither in the applications or processes running in the system... pretty weird... Any ideas about why this is happening and how to solve it?
Thanks
|
|
|
|
|
Hi all,
I want to define a shortcut key for MFC app,
(example. CTRL+Enter)
Please help me.
Every new thing you learn,Gives you a new personality.
|
|
|
|
|
To do what exactly? Your question is too vague, but for a generic answer, just handle WM_KEYDOWN events.
|
|
|
|
|
A Shortcut Key is a way to associate a key press with a shortcut, for example, the way <Windows-E> launches an Explorer window.
Is that what you are talking about, or did you mean a mnemonic, which is used to activate a control on a dialog/window like pressing <ALT+N> to activate a control that has a label of Name: , or an accelerator, which is used to activate a command (menu item) like pressing <CTRL+V> , which a common accelerator for Paste.
There are different ways of doing each.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Hi All
I am try to create a thread using createthread and this is my code
DWORD dwThrdParam = 10;
HANDLE hThread = CreateThread(NULL,0,WorkerProc, &dwThrdParam,0,NULL);
when i am debuging this then it is not going to "WorkerProc" so i am not able to understand whether this thread is running or not and this the thread
DWORD WINAPI WorkerProc(LPVOID pParam)
And it is returning some value.
may i know why it is not going to that thread while debuging
With regards
RYK
|
|
|
|
|
And what did you put in the function ? If it is empty, it will exit immediately and your thread will be terminated.
Did you put a breakpoint inside to check if you are going there ?
Beware also that dwThrdParam is a local variable to your function and you pass a pointer to this variable to your thread function. If the function from which you started the thread exits before the thread function gets called, the pointer will point to an invalid location.
|
|
|
|
|
Yaa i am putting break point in that thread. yaa "dwThrdParam" is local but i will handle later.
|
|
|
|
|
VC_RYK wrote: may i know why it is not going to that thread while debuging
Are you checking the return value from CreateThread()?
|
|
|
|
|
it is returning some valid value i.e(hThread = 0x00000f9c).
|
|
|
|
|
VC_RYK wrote: when i am debuging this then it is not going to "WorkerProc" so i am not able to understand whether this thread is running or not
Do you mean your break point is not being hit? Post the thread function code and explain in more detail what "it is not going to workerproc" means.
|
|
|
|
|
Are you waiting for your thread? If your main thread returns before your spawned thread returns, nothing good can happen of it.
|
|
|
|
|
Dear all
who has genetic or particle algorithm using vc++ or matlab snippet or demo? thanks all.
regards
Li Zhiyuan
25/6/2007
|
|
|
|
|
is it possible to set a menu to CWnd, CStatic etc?
|
|
|
|
|
CWnd having style overlapped or pop-up window can contain a menu bar; a child windows cannot have a menu bar.
However you can have "context menus" any where on the window
|
|
|
|
|
Hi ALL,
I am inserting my entry into the "Application" event log for Windows, thro, ReportEvent as follows,
bRet = ::ReportEvent( m_hEventSource,
wEventType,
0, //event category
INF_DUMMY,
psidCurrUser,
1,
0,
(LPCTSTR*)&lptszMessage,
NULL
);
it does one entry into the event log successfully.
but if i see the "Category" column in the event log its displayed as "None",
here i want to display some text(such as "Test category"),
If anyone know how to do it, please help me.
|
|
|
|
|
Hi,
Iam not very familiar to this. But I found in MSDN that for event id , categories you need to register message files EventMessageFile, CategoryMessageFile, and ParameterMessageFile to the registry.
Please search the msdn for messages files.
Since you passed 0 in the category it displayed none.
Best Regards
Raj
|
|
|
|
|
Yes i have created a message dll.
and i have given it as
MessageId=1
Facility=FACILITY_CHECK
SymbolicName=CATEGORY1
Language=English
Category 1
in mc file.
during call to ReportEvent,
if i give
bRet = ::ReportEvent( m_hEventSource,
wEventType,
CATEGORY1, //category
INF_DUMMY,
psidCurrUser,
1,
0,
(LPCTSTR*)&lptszMessage,
NULL
);
category column is not displaying with what text i have given for CATEGORY1.
it displaus as "Devices" in category column....
|
|
|
|
|
Have you correctly set the registry keys for the event source, particularly the "CategoryMessageFile" and its count.
And also if you define all the event, category and parameter in a single file the category must be the first.
-- modified at 9:21 Monday 25th June, 2007
|
|
|
|
|
Does any know how to implement C++ code into a C project
meaning I have a project that is C code and I code ( CLass of the code I trying to implement)
When I have a pointer to that class in a C stucture I get compile errors (maybe becuase the programs are .c extensions as opposed to .cpp)
I am using Visual Studio for the build
I am afraid If I change the extension of the programs to C++ .cpp It will screw other things up
is these anyway to "connect" these 2 piecies to code
Maybe write a compiler diretive e.g. extern CPLUSPLUS (just a guess)
Thankx
|
|
|
|
|
Hi,
Change the "compile as" option /TP this will compile your .C, .cpp file as C++ code.
That is change to CPP project.
|
|
|
|
|
This is a makefile project C code from what I understand paramter passing is different in C++
|
|
|
|
|
Just out of interest, how do you think your code might get screwed up if you change the file extension(s) to .cpp?
Cheers,
Dan
|
|
|
|
|
I think paramter passing is different for a C++ prog
|
|
|
|
|
I am basically trying to implemnt C++/C# code into a C makefile project
one project C makefile one C++/C# project into one soulution
|
|
|
|