|
Thank you for your comprehensive reply
Suggestion 1 didn't work, but it is probably better to have them all the same anyway, considering what affect that option has.
I used dumpbin on the offending library. It looks to me like it is defined but I would just like to check.
In the exports table the functions (e.g. resize) that the linker complains about are external and prefixed with __imp_. Is this why the linker is complaining?
Basically, one of the files in lib4 creates its own class which inherits from std::string. For older versions of C++, it has the lines
#using std::string
#define std_string string
in the header file.
For newer versions of Visual C++, it simply has
#define std_string std::string
What is the difference between these two?
As far as I can see, the header file calls the functions in inline functions without the specifier std::
Other than that those functions aren't overridden or referred to anywhere else.
|
|
|
|
|
WendyS56 wrote: In the exports table the functions (e.g. resize) that the linker complains about are external and prefixed with __imp_. Is this why the linker is complaining?
No - that's correct linkage to a function defined in a DLL.
WendyS56 wrote: What is the difference between these two?
The first replaces std_string by string and relies on the using (not #using, I believe) statement to make string resolve to std::string. The second just replaces std_string by std::string .
BTW - can you post the exact text of the LNK2005 message?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Here are a few of the linker errors (ciwsgif is my application):
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct>,class std::allocator<char> >::basic_string<char,struct>,class std::allocator<char> >(void)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ) already defined in ciwsgif.obj
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct>,class std::allocator<char> >::basic_string<char,struct>,class std::allocator<char> >(class std::basic_string<char,struct>,class std::allocator<char> > const &)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z) already defined in ciwsgif.obj
msvcprt.lib(MSVCP90.dll) : error LNK2005: "public: __thiscall std::basic_string<char,struct>,class std::allocator<char> >::basic_string<char,struct>,class std::allocator<char> >(char const *)" (??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z) already defined in ciwsgif.obj
|
|
|
|
|
WendyS56 wrote: already defined in ciwsgif.obj
I'm presuming ciwsgif.cpp is in one of your libraries?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Yes, ciwsgif is my main application file which uses the 4 libraries.
It includes <stdlib.h>, <assert.h> and <math.h> along with some header files corresponding to the 4 libraries.
|
|
|
|
|
Well...that's where the conflicting definitions are coming from
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Do you mean if my application includes "string.h" and some other library header files include "string" or "CString" then there would be a conflict?
Or is it because there are multiple includes of the same header file (i.e. string.h)?
|
|
|
|
|
WendyS56 wrote: Do you mean if my application includes "string.h" and some other library header files include "string" or "CString" then there would be a conflict?
Or is it because there are multiple includes of the same header file (i.e. string.h)?
No - multiple includes shouldn't do that. What that message is saying is that your main object contains definitions for the string methods. I'm not sure why, but that's what the message is saying.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thank you for clarifying things for me
When running dumpbin and looking at all the EXPORTS, basic_string is EXPORT'ed from lib4. I understand that to mean that these functions are made available by that library. Am I correct?
Would it make a difference to dynamically link my application to the libraries rather than statically linking to the .libs?
|
|
|
|
|
WendyS56 wrote: Would it make a difference to dynamically link my application to the libraries rather than statically linking to the .libs?
Could well do - with DLLs, you explicitly specify what is exported, whereas with static libraries, there's less control over what is visible from the library.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
My program compiles and links successfully now
I used dynamic linking to lib4. I then needed to remove the NODEFAULTLIB:"libcpmt.lib and NODEFAULTLIB:"libc.lib" from my application link options. (I still needed to have NODEFAULTLIB:"libcmt.lib")
Thank you for your help!
|
|
|
|
|
WendyS56 wrote: My program compiles and links successfully now
Excellent! That wasn't so difficult now, was it
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
May i know how can i get the screen resolution of the system and display a msgbox if the resolution is less than 1152*864....
|
|
|
|
|
|
I'm going to add more code into WM_PAINT hander, but I'm afraid to add to much to recude the performace.
I need a benchmark value to test if too much cpu tick is spended. Anybody has a value to share?
I know it depends on the different situation, but,.. I still like to see a estimated value.
|
|
|
|
|
|
Hi guys.
I have a fix for a edit box
I have a edit box (dialog box) which take string input ..........
The input at edit has a long limit i want to have finite entries in the edit box say string with 5 chars or number with 5 digits where i set the scope of the input string
|
|
|
|
|
How about sending it a EM_LIMITTEXT message?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hello Guys
Can anyone help me with "INSERT INTO" statement...
I need to insert variables into table(MSSQL) and my app. is in c++.
INSERT INTO TABLE_NAME (Col1,Col2,Col3)VALUES ('var1','58.5','15')
This is ok for constants but i cant made it work if i want to insert variables instead constants...
int var1;
int var2;
int var3;
INSERT INTO TABLE_NAME (Col1,Col2,Col3)VALUES (var1,var2,var3) ...?????
any ideas?
tahnks in advance, Komo
|
|
|
|
|
komofilms77 wrote: This is ok for constants but i cant made it work if i want to insert variables instead constants...
Can't you use string , sprintf() , or CString ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hope, the example below can help
graph::addvalue(int nummer, CString typ, CString kstartrnummer,int zeile, int spalte, CString betrag, CString text, int r, int g, int b)
{
CString abfrage;
char strbetrag[100];
CString cnummer, czeile, cspalte, cr, cg, cb;
sprintf(strbetrag, "%i\0", nummer);
cnummer = strbetrag;
sprintf(strbetrag, "%i\0", zeile);
czeile = strbetrag;
sprintf(strbetrag, "%i\0", spalte);
cspalte = strbetrag;
sprintf(strbetrag, "%i\0", r);
cr = strbetrag;
sprintf(strbetrag, "%i\0", g);
cg = strbetrag;
sprintf(strbetrag, "%i\0", b);
cb = strbetrag;
text.Replace("'", "''");
abfrage = "INSERT INTO Graph (Nummer, Typ, Kstartrnummer, Zeile, Spalte, Text, Betrag, r, g, b) VALUES (" ;
abfrage = abfrage + cnummer + ", '" + typ + "', " + kstartrnummer + ", " + czeile;
abfrage = abfrage + ", " + cspalte + ", '" + text + "', ";
abfrage = abfrage + betrag + ", " + cr + ", " + cg + ", " + cb +")";
db.ExecuteSQL(abfrage);
}
Good luck, Gérard
|
|
|
|
|
i made it with sprintf and works great thanks guys
|
|
|
|
|
BSTR strLoggedInUser=GetLoggedInUser();//is this line of code is correct or i use wcscpy here.
BSTR value=::SysAllocStringLen(L"",::SysStringLen(strLoggedInUser));
wcscpy(value,strLoggedInUser);
::SysFreeString(strLoggedInUser);
///////////////////////////////////////////////////////////////////////
HRESULT hr = pclsObj->Get(L"Manufacturer", 0, &vtProp, 0, 0);
BSTR strItemName =vtProp.vt==VT_NULL?L"-NA-":vtProp.bstrVal;// here too is this line of code is correct or i use wcscpy here.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
BSTR value=::SysAllocString(strLoggedInUser);
You need to google first, if you have "It's urgent please" mentioned in your question.
_AnShUmAn_
|
|
|
|
|
|