Advertisement

ambiguous symbol, lots of errors

Started by July 12, 2001 03:15 PM
8 comments, last by KeybeeTNM 23 years, 7 months ago
Yesterday I downloaded mysql++ from www.mysql.com, the installation instructions where easy. Actually there werent any =) Anyway, when I tried to execute one of the simple examples using one of the mysql++headers I got tons of errors! 102 "ambiguous symbol" errors. Someone said something about a library, but what do I do with it? Its name is mysql++.lib and im using MS Visual C++ 6.0 PLEASE HELP!
Little newbie
Isn''t that supposed to be what namespaces are for dealing with?
Advertisement
I aint getting anywhere so if anyone has used the mysql++ library successfully, please help me before I smash the monitor against a concrete wall cause that would be kind of expensive...
Little newbie
Have you added the library to the project? If not, goto Project...Settings...Link and type in 'mysql++.lib' in the Object/Library modules.

Oh, and I don't have MySQL++, I'm just making a guess based on what you said . I'll download it and let you know.

[EDIT]

On downloading MySQL++, I got the files in 'examples.dsw' compiled without any problem. Make sure you open and build the 'mysqlpp.dsw' workspace first, because is what creates the mysql++.lib file. I didn't have to change the project settings, so that shouldn't be necessary. Which example are you trying to compile?

[/EDIT]


Edited by - DarkAvenger on July 16, 2001 5:50:20 PM
Cant thank you enough... What executable file is the mysqlpp asking for? I dont know what to browse for...

I tried simple1.cpp but I hadnt executed the mysqlpp.dsw at that time. Thanks again for all the help but I dont know what to do w/ the "select the executable file"-question...

Huge amount of "ambigous symbol" errors whatever I do... I cant understand why, Ill try to download the hole package once more and start all over... *hmmm, what to do?*

Edited by - KeybeeTNM on July 16, 2001 7:48:37 PM
Little newbie
I can successfully run the simple1 example now, all thanx to you DarkAvenger. But I dont know how to use the funktions in my own programs, I get all those errors if I try to "barrow" the code from simple1.cpp and put it in my project. I then include the mysql++ and put the mysql++.lib in a Library Files dir in the FileView window. I think the problem is all the External Dependencies the simple1 project has... if that is the problem then how do I include them? Else, whats wrong?

Open for suggestions
Little newbie
Advertisement
AMBIGUOUS SYMBOL means that there are more than one possible match for the symbol ... and these things always get listed out forever so forget the 102 part ... that''s just where the compiler was set to quit telling you about them ... there are really more ... but they will all be fixed with a single correction.

First ... you need to distinguish between COMPILER and LINKER errors ... if you read the text above the first error ... or just follow the message box from the top ... you can figure out if the program broke during compile or if it compiled successfully and then broke during linking ... this is critical to finding and fixing any common error.

also .. when posting errors .. post there number ... like LNK4006 ... so us with visual studio can play around and make sure we''re seeing the same thing ...

now .. about your specific situation .. if it didn''t have a neccessary lib file in the list .. you would get a LNK2001 "Unresolved External Symbol" error ... so it''s not that simple .. please post your exact error and we''ll try to be more helpful
I spent a day fighting with the same thing a month ago...

If I remember right, it has to deal with mfc including iostream stuff, and libc.lib doing the same.

I believe the correct solution was to go into the mysql++ project, and change the General->Microsoft Foundation Classes from Not using MFC to one of the other two (of course, if your main project isn''t using mfc in the first place, the error is probably something else)

If you want to get a bit more complex, copy the configurations and make new MFC only configs, with different output libraries (ie, mysql++mfc.lib). This is optional, so just ignore this paragraph if you dont'' understand what i''m doing.

And a warning...you''ll probably get alot of warnings (4786) about long names and debugger not being able to use them. Their not important, but there''s no way to get rid of them, even with #pragma warning(disable:4786) (confirmed bug in MSVC) I dumped this in front of the mysql to get rid of warnings that seemed irrelevant from mysql:

#pragma warning(push)
#pragma warning(disable:4786)
#pragma warning(disable:4800)
#pragma warning(disable:4273)
#pragma warning(disable:4355)

#include

#pragma warning(pop)

I hope it helps...I had a hard time getting mysql++ to work, so best of luck to you
Ok, thanks to all of you I''ve come a long way now! Theres still one problem though, when I try to use mysql in my own projects I get a huge amount of errors all over again, but this time its something else:

LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
LIBC.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/M8G8.exe : fatal error LNK1120: 1 unresolved externals

Now thats only the bottom lines of the Output window, it was a total of 35 errors, the ones at the top looked more like this:

msvcprtd.lib(MSVCP60D.dll) : error LNK2005: "class std::basic_ostream > & __cdecl std::operator<<(class std::basic_ostream > &,char const *)" (??6std@@YAAAV?$basic_ostream@DU?$cha
r_traits@D@std@@@0@AAV10@PBD@Z) already defined in mysql++.lib(sql_query.obj)

Damn, why me!? =)
Little newbie
Thanks for all the help everyone, I finally got the mysql functions to work with my own project! I had to force some msvcprtd.lib and another one not to participate =)... I would appreciate if I could have a chat with "The Anonymous Poster" above if you happen to know anything about storing the Result... like this:

CString myquery= query.preview or
char myquery= query.preview

None of these work and they use cout in the examples so I dont know how to get the value of query.preview into an editbox or a MessageBox()

The error I recieve is as follows:
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class std::basic_string,class std::allocator >' (or there is no acceptable convers
ion)


Thanks for all the help once again


Edited by - KeybeeTNM on July 18, 2001 6:48:20 PM
Little newbie

This topic is closed to new replies.

Advertisement