undefined reference to 'SQLGetInstalledDrivers'

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

undefined reference to 'SQLGetInstalledDrivers'

notmmao
I am using mingw with gcc version 3.4.5 on Windows XP.

    gcc -o getdriver.exe getdriver.c -lodbccp32

getdriver.c:
-------------------------
#include <windows.h>

int main() {
        LPSTR szBuf = (char*)malloc( 1024*8 );
        if( szBuf == NULL) exit( 1 );
       
        WORD cbBufMax = 1024*8;
        WORD cbBufOut;
       
        LPSTR pszBuf = szBuf;
       
        if( !SQLGetInstalledDrivers( szBuf, cbBufMax, &cbBufOut ) )
                exit( 1 );
       
        do {
                printf( "%s" , pszBuf );
        }
        while( pszBuf[1] != '\0' );
       
        free( szBuf );
        return 0;
}

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference to 'SQLGetInstalledDrivers'

Keith Marshall-2
notmmao <[hidden email]> wrote:
> I am using mingw with gcc version 3.4.5 on Windows XP.
>
>     gcc -o getdriver.exe getdriver.c -lodbccp32
>
> getdriver.c:
> -------------------------
> #include <windows.h>

You need to add `#include <odbcinst.h>' here.

> [...]

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming
Reply | Threaded
Open this post in threaded view
|

Re: undefined reference to 'SQLGetInstalledDrivers'

Keith Marshall-2
In reply to this post by notmmao
notmmao <[hidden email]> wrote:

> I am using mingw with gcc version 3.4.5 on Windows XP.
>
>     gcc -o getdriver.exe getdriver.c -lodbccp32
>
> getdriver.c:
> -------------------------
> [...]
>
> do {
> printf( "%s" , pszBuf );
> }
> while( pszBuf[1] != '\0' );

This is an infinitely repeating loop!

Regards,
Keith.

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
MinGW-users mailing list
[hidden email]

You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users

_______________________________________________
This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.

Most annoying abuses are:
1) Top posting
2) HTML/MIME encoded mail
3) Improper quoting
4) Improper trimming