|
|
|
Hi All,
I try to create some simple applications using WindowsForms. I use Visual Studio .Net 2003, Academic version.
Lets say I have a form and a button.
When I double click on the button, I create an event for click. Then I can
write all the code to deal with that event, and everything works fine. The
only problem I have is that the code gets written in the header file, instead
of being placed in the cpp file.
I have some experience programming with Borland C++ Builder, and I compare the results with the ones from BCB.
I expect that when I add an event, the function definition should be placed in the header file, and the function implementation, in the cpp file.
Did I miss a setup option, or is there an option set up wrong? I don't consider normal that all the code gets written in the header file. What is the right procedure, so that when someone adds an event for a button, the event function to be added to the cpp file?
I tried to move the function from the header file to the cpp file, and to leave the definition of it in the header, but now I get a lot of errors.
To make it worse, the samples provided by Microsoft don't contain code in C++, only VB and C#. Is C++ dying, should I start learning C# instead?
Regards,
Nicolae
|
|
|
|
|
Did the application run?
Nicolae Fieraru wrote:
Is C++ dying, should I start learning C# instead?
No C++ is not dying. There are times when you need C++ to write an application. But you should learn C#, it`s the future language.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Yulianto AKA goodmast3r wrote:
C#, it`s the future language
maybe it's yours, but i'm not sure i need it absolutely for what i program...
you use a language because you need its advantages, not because it is a supposed language of the future...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
you use a language because you need its advantages, not because it is a supposed language of the future...
It`s language of the future, because of it`s advantages, simpleness.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
but admit you don't need all the C#'s features to program a simple HC-11 for example...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Yes true.
<italic>Work hard and a bit of luck is the key to success. You don`t need to be genius, to be rich.
|
|
|
|
|
Yulianto AKA goodmast3r wrote:
But you should learn C#, it`s the future language.
I just have seen some MS-guys marketing the Whidbey compiler saying that C++ will be *the* prime .NET language when it comes to control of the code. It will not be as RAD as VB.NET, but all about control at the coselevel. You can seamlessly go from .NET-Framework to assembler and back to unmanaged C++ in one project.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
|
Thank you Selvam for your reply. I've already seen examples of console applications, my question is very specific, regarding the WindowsForms application. I start to think that actually very few programmers use C++ and WindowsForms at the moment, because I asked twice on the microsoft newsgroups and once in here and still nobody told me if it is normal to implement the events functions in the header or not. I talked to a programmer who is using VS .Net 2003 and MFC and he said that when he creates an event, it creates the body for function in the cpp file (as it should be). Which is not the case with WindowsForms. I don't mind having a tiny cpp file and a large header file with all the code in it, if this is what Microsoft intends to do. If that's the case, we should have been warned about this change of strategy...
Regards,
Nicolae
|
|
|
|
|
Hello,
I get a link error when I compile, is there anyone that now hat it meens and now how I can fix this?
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
|
|
|
|
|
Only one version of the CRT library (C Runtime Library) may be linked to an application.
But different versions of the C Runtime Library exist for different application types - i.e single thread vs multiple thread vs DLL, etc.
You need to make sure the correct CRT library version is linked which in turn depends on your application type.
Search MSDN for the following topics:
"HOWTO: Link with the Correct C Run-Time (CRT) Library"
or just do a search on the LNK4098 error.
This will tell you which specific library you need to link based on your application type and how to exclude the CRT libraries that are not valid for your app.
Robert
|
|
|
|
|
Well I have a MFC there I have link a dll. I don't now how I can fix this!.
|
|
|
|
|
|
Try this go to the Project menu in the main window(file,edit,view,project),then go to your project properties then go to the linker,in linker go to Input and in ignore specific libraries add LIBC.
for eg:
Ignore Specific Library LIBC;msvcrt
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
hey
i was surfing around and stumbled across the bitset.. i'm curious - how does it work??? i didnt think it was possible 2 address single bits in memory..
i got some very funny results with this code:
bitset<10> a;
cout<<sizeof(a);
cout<<" "<<&a[4];
cout<<" "<<&a[4];
cout<<" "<<&a[2];
here's wt i get:
4 0x0012FF74 0x0012FF6C 0x0012FF64
y is sizeof(a) 4????
if i make a bitset of 33 bits, then th size becomes 8, so i gues it gets stored in multiples of 4 bytes??? so if ur nt actualy storing single bits, then wt r bitsets used 4???
and wts with the the addresses?? how is it tht the adress of the same bit is different the second time??? (and even if i change the number in the 4th line from 4 to nethin else, i stil get the same output)
clearly, u cant refer 2 th address of a single bit... then how is a bitset impelemnted???
and because of al this, wudnt they be inherently slow to access???
im new 2 c++ so sorry if iv askd somthin silly
HellFuer
|
|
|
|
|
with bitset, operator [] doesn't give you an array element, like it would with a normal C/C++ array. in bitset, operator [] returns the value of the bit at the position you requested.
so, &a[4] isn't the address of the 4th bit, it's the address of the value returned from the [] operator. not very useful.
HellFeuer wrote:
then how is a bitset impelemnted???
looking at the BITSET header file:
template < size_t _N > class bitset {
typedef unsigned long _Ty;
...
private:
enum {_Nb = CHAR_BIT * sizeof (_Ty),
_Nw = _N == 0 ? 0 : (_N - 1) / _Nb};
...
_Ty _A[_Nw + 1];
_N is the bitset size. _Nw is the number of bytes required to hold your bits. so, internally, it's an array of unsigned ints - but you can't get at that internal array with the [] operator.
HellFeuer wrote:
and because of al this, wudnt they be inherently slow to access???
yup.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
HI,
I seem to be getting this error,actually the debugger juist stops and then gives me a dialog box saying Debug Assertion Failed(with ignore,retry,abort).However,none of them help my proj in running.
The box gives me something like
Debug Assertion Failed
File : f:\vs70builds\vc\MFCATL\ship\atlmfc\include\afxcoll.ini
line : 204.
This appears on a particular point everytime,when I try to execute the line
pVar = (CVarData*) m_arrayVariables.GetAt(iVarIndex);
(where CVarData* pVar; & CPtrArray m_arrayVariables;)
This is in a function called GetValue(a member of class CVars).The variable of CVars used to get here is initialised in the constructor of the original class(CHPMumsCtrl) and is a part of public members of the calling class(CCalc).
If anyone can tell me what to do here,then it will help a lot.Can someone tell me the cause anything at all will be helpful.
Thanks.
|
|
|
|
|
Try to Run in Relase Mode and Tell, What happen to Project
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
When I try to run it in release mode then it gives me 462 build errors.Most/all of them look like this.
NewMumsEngine error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)
What do I do now?Any suggestions please?
Thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
|
It is an C++ engine that acts as a parser,ie it recieves messages and sends messages. On recieving messages it parses them and then takes action accordingly. It firsts loads a script for processing(parsing),then it displays the script according to the parsed results and sends messages accordingly to the server.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|
|
Hi Mr. Arjun
at what point you are getting the debug assertion i.e. during receiving or parsing.
i think it is at the time of parsing,it ususal programmer break the boundry of MS collection arrays.
as assertion is not applicable in RELEASE MODE, thats why i ask you to Build in relase Mode (though it bad programming habit to test the product in release mode),but it surely tell you where you getting error.
hope yuo understand.
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
Hi Alok,
When I try to run it in release mode then it gives me 462 build errors.Most/all of them look like this.
NewMumsEngine error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall bad_cast::bad_cast(char const *)" (__imp_??0bad_cast@@QAE@PBD@Z)
The debug assertion failure that i get is a run time error...but in the release mode i get so many errors(build/compile),i cannot even get the project to run,can u help me clear these errors then please
Thanks,
Arjun.
Arjun Mukherjee
Software Engineer
Hewlett Packard
|
|
|
|