Greetings From Prakash.A I am working in Sybmian C++ env.. Now I have the following problem.
I have creted a userdefined class "CSocketsEngine" in a seperated file "SocketsEngine.h, .cpp" inside this class I created the function "NewL()" and "NewLC()" both are static fucntions and " ServerName(), SetPort()" these are ordinary functions.
I created the object for this class(CSocketsEngine) in "Socketappui.h" and try to call the above functions in "Socketappui.cpp".
It is compiled properly, but when I tried to build the above code the following error that " LNK 2001, unresolved external public static __this call NewL().." occurs. The same error occurs for "NewLC()" ,"ServerName()" ," SetPort()" these functions also.
I hope some libray files are missing in the .mmp files.. But I dont know the name of that libray file..so can you please tell me the exact library files to be inculded in the project or whether is there any other solutions is avaiable? If so please help me It is needed very urgently please. So please help me..
If two of your own classes cannot call each other this is probably not a problem with libraries, but some other problem which is hard to tell without looking at the relevant files. Maybe you can post your .mmp and the relevant parts of the 2 header and the 2 .cpp files here?
And, by the way, isn't everything in one's own life always very urgent? Especially if one needs help? Are you sure that your chances are higher to get an answer if you declare your problem "very urgent"?
So why don't you do now as I adviced you and post the relevant parts of your files here so people at least have a chance to find out what is your problem?
Well, I see nothing strange. NewL and NewLC are commented-out in the code that you posted, but since you told that the whole thing compiled, this may be some in-between-state of your source when you tried something.
I am not sure whether _LIT can be used outside of any method, like you do with _LIT(KDefaultServerName, "127.0.0.1") but this may be just a lack of my knowledge about Symbian, and has probably nothing to do with your problem.
Quote
I created the object for this class(CSocketsEngine) in "Socketappui.h"
Do you really mean this? You created the object in the .h file? How does this part of your code look like (only the part where you create the object and try to use it, anyway)?
Can you post the exact error message you are getting as well as the MMP file.
If as you say in the original post you are getting errors with NewL() not being defined then this is correct, you do not have a function called NewL with no parameters, the NewL you defined takes a reference to some callback structure.
The errors almost certainly the result of not including SocketsEngine.cpp in your mmp file.
Actually in my program the "NewL()" and NewLC() functions are not comment. After I tried all the possibilities then I sent that the final code. So in that file actually these 2 funcions are not commented.
Here with I have attached the original file. Please do the needful.
And in the .mmp file I included the SocketEngine.cpp file from the beginning onwards. But the same erros occurs.
Note: And onething that If I declar the functions "SePort()" and "ServerName()" as virtual then the errors has gone. It is the right way to declare as virtual. or any other way is available.?
My dear, it is really that hard? Please post the .mmp also, as you have been adviced already about 3 times. It's not a secret, that .mmp, or is it? Maybe you included your .cpp file in question there, but in a wrong way, that does not give an error while compiling but results in an error while linking.
And you did not answer my question whether you really tried (or not) to include code in your .h file. It would be really great if you would also post the relevant parts of the files that try to use your SocketsEngine class (the part of the .h and the part of the .cpp that reference it). Just cut and paste them as a part of your next message!
And no, I don't think it will be useful to declare those functions "virtual".
Right now I am at work where I cannot compile Symbian projects. Probably this evening I will be able to do this.
But from my first look at your files, a question: Why are TimeOutNotifier.cpp and TimeOutTimer.cpp not in your .mmp file? You seem to use them, so you need them as well in your list of .cpp files in the .mmp file, if you ask me.
Forum posts: 1321
And, by the way, isn't everything in one's own life always very urgent? Especially if one needs help? Are you sure that your chances are higher to get an answer if you declare your problem "very urgent"?
René Brunner
Forum posts: 278
just check in your mmp file whether you've included these libaries or not :
in_sock.h
es_sock.h
..
(by the way please write in the subject wat you are asking..not urgent Help! )
Forum posts: 276
All the files of the project should be included in the .mmp file.
Dennis
Today is a gift by GOD, that's why it is called the present.
Forum posts: 18
Thanx dennis,
Ya I included all the .cpp files in .mmp files. But still the error occurs? Plase help me
Try Try Try , Until You Die
Forum posts: 1321
P l e a s e help us help you.
René Brunner
Forum posts: 18
I have attached the needed files. pleae do the need ful
With Regards,
Prakash.A
Try Try Try , Until You Die
Forum posts: 1321
I am not sure whether _LIT can be used outside of any method, like you do with _LIT(KDefaultServerName, "127.0.0.1") but this may be just a lack of my knowledge about Symbian, and has probably nothing to do with your problem.
Do you really mean this? You created the object in the .h file? How does this part of your code look like (only the part where you create the object and try to use it, anyway)?
René Brunner
Forum posts: 140
If as you say in the original post you are getting errors with NewL() not being defined then this is correct, you do not have a function called NewL with no parameters, the NewL you defined takes a reference to some callback structure.
The errors almost certainly the result of not including SocketsEngine.cpp in your mmp file.
Paul Todd
Forum posts: 18
Actually in my program the "NewL()" and NewLC() functions are not comment. After I tried all the possibilities then I sent that the final code. So in that file actually these 2 funcions are not commented.
Here with I have attached the original file. Please do the needful.
And in the .mmp file I included the SocketEngine.cpp file from the beginning onwards. But the same erros occurs.
Note:
And onething that If I declar the functions "SePort()" and "ServerName()" as virtual then the errors has gone. It is the right way to declare as virtual. or any other way is available.?
Please do the needful
With Regards,
Prakash.A
Try Try Try , Until You Die
Forum posts: 1321
And you did not answer my question whether you really tried (or not) to include code in your .h file. It would be really great if you would also post the relevant parts of the files that try to use your SocketsEngine class (the part of the .h and the part of the .cpp that reference it). Just cut and paste them as a part of your next message!
And no, I don't think it will be useful to declare those functions "virtual".
René Brunner
Forum posts: 18
Here with I have attached all the necessary files including .mmp files. Pleaes do the needful.
With Regards,
Prakaskh.A
Try Try Try , Until You Die
Forum posts: 1321
Right now I am at work where I cannot compile Symbian projects. Probably this evening I will be able to do this.
But from my first look at your files, a question: Why are TimeOutNotifier.cpp and TimeOutTimer.cpp not in your .mmp file? You seem to use them, so you need them as well in your list of .cpp files in the .mmp file, if you ask me.
René Brunner
Forum posts: 18
As I am very stranger to Symbian I am very struggle to do this. I am also try my best to make this as a successful thing..
With Regards,
Prakash.A
Try Try Try , Until You Die
Forum posts: 140
A link error is being generated by the CSocketsAppViewL::NewL being commented out, not by the Socket engine's NewL.
Removing virtual has no effect.
I commented out the CAknGlobalNote in ErrorNotify and the timer code and it all seems to build okay.
I suggest you do a clean and then a full rebuild or reimport the mmp file back into the IDE
Paul Todd
Forum posts: 18
If the things is OK.
can you please send the correct code...
Please
With Regards,
Prakash.A
Try Try Try , Until You Die