|
|
Home » U++ Library support » U++ SQL » SQL_mySQL reference problems
SQL_mySQL reference problems [message #1505] |
Tue, 07 March 2006 14:21  |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
Hi all ...
I've noted the other posts relating to the SQL_MYSQL reference programe. I have link errors under windows (mysql v5). The errors seem pretty basic for a "reference application".
There are two other points.
- The {Setup} / {Automatic Setup} for MYSQL doesn't show the mysql path in te text box.
- Also I see a duplicate linkage/reference for "__main()". This looks like another linking issue, against mingw this time.
The critical bits of the output are below.
I began this thread to record, (a) how to 'fix' these issues; and (b) To encourage the "reference" samples can be clean builds from user feedback.
Cheers,
Will
Quote: | __[ output ]_____________________
:
:
----- SQL_MySql ( MT MAIN GCC DEBUG DEBUG_FULL BLITZ WIN32 ) (5 / 5)
Linking...
(option '-O 2' ignored)
___main: duplicate
-> used: libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
14 undefined symbol(s):
_mysql_affected_rows@4 (referenced from c:\bin\upp\out\mysql\mingw.debug_full.mt\mysql.o:1; MySqlSession::IsOpen(void)
const; MySqlSession::IsOpen() const; sEmpNull(char const *); sEmpNull(char const*); ...)
_mysql_close@4 (referenced from c:\bin\upp\out\mysql\mingw.debug_full.mt\mysql.o:1; MySqlSession::IsOpen(void) const; M
ySqlSession::IsOpen() const; sEmpNull(char const *); sEmpNull(char const*); ...)
_mysql_error@4 (referenced from c:\bin\upp\out\mysql\mingw.debug_full.mt\mysql.o:1; MySqlSession::IsOpen(void) const; M
ySqlSession::IsOpen() const; sEmpNull(char const *); sEmpNull(char const*); ...)
_mysql_fetch_field_direct@8 (referenced from
. . . etc
|
Kind regards,
aplatypus
________________________________________
[Updated on: Tue, 07 March 2006 14:22] Report message to a moderator
|
|
|
|
Re: SQL_mySQL reference problems [message #1535 is a reply to message #1518] |
Wed, 08 March 2006 10:50   |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
Hi Mirek,
I did some investigations on the U++ project. I does attempt to link against the SQL_MySql.dll file 'out of the box'.
The missing symbols are all present in the SQL_MySql.DEF file (in the /lib/ folder). I also took pointed the linker to "_\MySQL Server 5.0/lib/debug/libmysql.dll" and optimised version "_\MySQL Server 5.0/lib/debug/libmysql.dll".
I'm not sure what could be 'wrong' other 'reference' programs I build work OK. The DEF file is 'correct'. A clue might be available in the minGW docs, concerning the order of the files in the build command, viz.:
Another line to pursue is ...
There are other hints in the minGW materials, it might take some time to check them all. Also it looks like I have to figrue how to control the build for U++. Is using ANT or MAKE an option?
Hopefully someone has got a mySQL programme working with minGW and will supply the missing link before I get there. Psst there si not need to prove me wrong on that *lol*
Cheers,
William
Kind regards,
aplatypus
________________________________________
[Updated on: Wed, 08 March 2006 11:05] Report message to a moderator
|
|
|
Re: SQL_mySQL reference problems [message #1541 is a reply to message #1535] |
Wed, 08 March 2006 15:05   |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
recent update ...
The minGW reference material indicates this problem is to do with the sequence of #include files in the sources.
Ihave seen this problem a lot with the microsoft compilers, when the <windows.h> is included in the wrong place.
Unfortunately I don't (yet) get all the sbutlities of the include dependencies. As an aside, it would be really useful for one of the Assits++ tools to manage dependencies (of various kinds).
When I look at the generated preprocessor output, indeed the mySQL.h files are included before the windows.h file. My diffculty so far appears to be the stuff and the order includes are used in <core.h>.
I am not precisely sure why this affects the linkage. The library and object file sequences used to be in the ld command line. My suspicion is that the 'problem' is a side-effect and if I could specify linkage explicitly it might work a-OK. Though I admit to guessing here.
That's what I know. If I'm on the wrong track, tell. File that links with a Microsoft compiler will link with minGW objects and libraries. The question might be about how I set-the-order for searching libraries during linking.
Nice chatting,
... Will.
Kind regards,
aplatypus
________________________________________
|
|
|
|
|
|
|
Re: SQL_mySQL reference problems [message #1647 is a reply to message #1640] |
Sat, 11 March 2006 12:38   |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
Once more Mirek,
Many thanks. As the saying goes, I had some good news and some not so good news. Putting the new library removes the unresolved symbols link errors.
This still leaves the SQL_MySql project with a different error that that doesn't make sense to me.
Quote: | Linking...
c++ -static -mwindows -mconsole -o "c:\bin\upp\out\MINGW.Debug_full.Mt\SQL_MySql.exe" -ggdb -L"C:\
bin\upp\mingw\lib" -L"C:\bin\upp\SDL-1.2.9\lib" -L"C:\bin\MySQL\MySQL Server 5.0\bin\" -Wl,-O,
2 "c:/bin/upp/out/SQL_MySql/MINGW.Debug_full.Main.Mt/main.o" "c:/bin/upp/out/MySql/MINGW.Debu
g_full.Mt/MySql.o" "c:/bin/upp/out/Sql/MINGW.Debug_full.Mt/$blitz.o" "c:/bin/upp/out/plugin/z/
MINGW.Debug_full.Mt/zlibupp.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/adler32.o" "c:/bin
/upp/out/plugin/z/MINGW.Debug_full.Mt/compress.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt
/crc32.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/deflate.o" "c:/bin/upp/out/plugin/z/MIN
GW.Debug_full.Mt/gzio.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/infblock.o" "c:/bin/upp/
out/plugin/z/MINGW.Debug_full.Mt/infcodes.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/inff
ast.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/inflate.o" "c:/bin/upp/out/plugin/z/MINGW.
Debug_full.Mt/inftrees.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/infutil.o" "c:/bin/upp/
out/plugin/z/MINGW.Debug_full.Mt/trees.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/uncompr
.o" "c:/bin/upp/out/plugin/z/MINGW.Debug_full.Mt/zutil.o" "c:/bin/upp/out/Core/MINGW.Debug_ful
l.Mt/$blitz.o" "c:/bin/upp/out/Core/MINGW.Debug_full.Mt/OL_Set.o" -Wl,--start-group -lUppMySQ
L.lib -ladvapi32 -lshell32 -lwinmm -lole32 -loleaut32 -luuid -Wl,--end-group
c++.exe: no input files
Exitcode: 1
There were errors. (0:00.59)
|
The bit that comounds me is the "no input files" message. When i looked in the relevant Upp/out folders all the files I would have expected to find and use for input are there.
Does someone have an idea what "input" is missing?
Slow and steady progress ....
.../William
Kind regards,
aplatypus
________________________________________
|
|
|
Re: SQL_mySQL reference problems [message #1649 is a reply to message #1647] |
Sat, 11 March 2006 13:45   |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
Greetings friends ...
I have made one further discovery -- I suspect that the 'next' error will be readily resolved by a U++ aficinado.
The new library I made was in a directory with spaces in the name. When I moved this file to folder "c:\bin\mysql\UppMySql.a" from "c:\bin\mysql\C:\bin\MySQL\MySQL Server 5.0\bin\" that problem resolved itself. This is the new library deswcribed in Mirek's post about minGW and mySQl.
Also the file must use the "libUppMysql.a" extension. Earlier I made the error of calling it with a ".lib"-extension. The "lib"-part and the ".a"-extension are required.
However there is a further linking problem concerning the "_WinMain" entry point. I suspect that this will be a minGW issue. It seems so fundamental, I wondered if someone has already found a way to do this already.
cmd output: | ___main: duplicate
-> used: libmingw32.a:gccmain.o:1
-> discarded: libgcc.a:__main.o:1
1 undefined symbol(s):
_WinMain@16 (referenced from libmingw32.a:main.o:1; _main; .text)
linking aborted due to fatal errors
collect2: ld returned 1 exit status
|
This output is from the windows command line. The output window in TheIDE only said, ...
TheIDE output: | c++.exe: no input files
Exitcode: 1
|
I admit to being mildly confused here. Other GUI reference programs work OK. The SQL_MySql reference loks like it is a console program, may be that is the 'catch'.
In the meantime, I found this pearl. Concerning how ld works for minGW.
web search: | http://www.cygwin.com/ml/cygwin/2004-03/msg00194.html
To resolve _WinMain@16 with a symbol from your library, it needs to come *after* the library that needs it (/usr/i686-pc-mingw32/lib/libmingw32.a).
Unfortunately (for you), gcc/g++ puts all the default libraries *last* when it calls ld. You need to override that order.
.. link your app using the following command:
g++ -mwindows -mno-cygwin -o test.exe test.o -lmingw32 -L./ -lmaintest
|
There are some slow chips at the solution. Wiser heads are welcome. Is there some way to specify the exact commands to build with minGW? Why do other reference projects work with minGW?
I know everyone loves their own creations. I sincerly recommend that anything called a "reference" program include a comment certifying the "platforms it has been tested on", and the platforms it has not tested for if applicable.
It is an excellent system. Unfrotunately my use for U++ at the moment is with mingGW and SQL on Windows. I could go to the microsoft compilers -- Can anyone tell me if they have run the mysql with Microsoft c++? This is such a small problem -- keep up the good work!!
Aloha,
Will.
Kind regards,
aplatypus
________________________________________
[Updated on: Sat, 11 March 2006 14:24] Report message to a moderator
|
|
|
|
Re: SQL_mySQL reference problems [message #1667 is a reply to message #1650] |
Sun, 12 March 2006 12:50   |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
Hy there Mirek
Thanks for your comments, I am not sure of their meaning though. The SQL_MySql demo is a console program. Why do I want to use the "GUI_APP_MAIN" macro here? My question is this, How does a console program come to ask for a '_WinMain' entry point?
And of course, How do I make the console program that isn't looking or the '_WinMain' entry point?
The error: "No ipput files.", is the only message in TheIDE's output window from the link-command asking for a '_WinMain' entry.
If the new release will correct the issue, then perhaps I will wait for that. It looks to me as if the issue is not with the program as much as in the way the mysql builds are done under minGW.
If you run a build of the SQL_MySql project with a library file made from the DLL with the minGW dlltool program ...
Quote: |
c:\> dlltool.exe --dllname libmySQL.dll --output-lib libUppMySQL.a -k
|
That will reproduce the "no input" error message. Or if it doesn't, I can go over everything to find my mistake.
Thanks for the support, he tips are helping, there is slow progress. And I'm learning more about Ultimate.
Cheers,
Will.
Kind regards,
aplatypus
________________________________________
|
|
|
|
|
Re: SQL_mySQL reference problems [message #1933 is a reply to message #1926] |
Tue, 28 March 2006 02:31  |
aplatypus
Messages: 11 Registered: March 2006 Location: Newcastle, Australia
|
Promising Member |
|
|
main.cpp
if(!session.Connect( "mySelf", "passw", "mysql", "localhost" ))
{
}
Mirek
I am no MySql expert so a direct question: Do you propose to put above to
reference/SQL_MySql as it is more likely work out of box?
Hi Mirek
That's a good question ... The mySQL installation will have some username and password (or 'should') so the code will not work "out of the box" unless the correct username and password is used.
The "mysql" database name is always used.
I can suggest a couple of lines of comment saying to
- 'substitute your username and password in the code below.'
The same situation should apply to the other database examples. I strongly advise using a test username (not the root username) in an example programme.
Cheers,
Will
Kind regards,
aplatypus
________________________________________
[Updated on: Tue, 28 March 2006 02:32] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat Apr 26 19:22:59 CEST 2025
Total time taken to generate the page: 0.00566 seconds
|
|
|