C code using gcc cannot link to mysql header?
I'd like to build on this post, because my symptoms are identical, but the solution seems to be something else.
I am working in a Ubuntu container (Ubuntu 16.04.3 LTS), trying to compile a toy C program that will eventually connect to an SQL server. First things first: I have the latest libmysqlclient-dev installed:
root@1234:/home# apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 88 not upgraded.
root@1234:/home#
And when I look in the /usr/include/mysql directory, I see the critical header file I'll need:
root@1234:/home# ls -l /usr/include/mysql | grep mysql.h
-rw-r--r-- 1 root root 29207 Oct 4 05:48 /usr/include/mysql/mysql.h
root@1234:/home#
So far, so good. Now I found this little toy program from here:
#include <stdio.h>
#include "/usr/include/mysql/mysql.h"
int main() {
MYSQL mysql;
if(mysql_init(&mysql)==NULL) {
printf("nInitialization errorn");
return 0;
}
mysql_real_connect(&mysql,"localhost","user","pass","dbname",0,NULL,0);
printf("Client version: %s",mysql_get_client_info());
printf("nServer version: %s",mysql_get_server_info(&mysql));
mysql_close(&mysql);
return 1;
}
Now, following the advice of the previous post, I compile using the "-I" option to point to the mysql.h header file. (Yes, I am required to use GCC here):
root@1234:/home# gcc -I/usr/include/mysql sqlToy.c
/tmp/cc8c5JmT.o: In function `main':
sqlToy.c:(.text+0x25): undefined reference to `mysql_init'
sqlToy.c:(.text+0x69): undefined reference to `mysql_real_connect'
sqlToy.c:(.text+0x72): undefined reference to `mysql_get_client_info'
sqlToy.c:(.text+0x93): undefined reference to `mysql_get_server_info'
sqlToy.c:(.text+0xb4): undefined reference to `mysql_close'
collect2: error: ld returned 1 exit status
root@1234:/home#
Belly flop! The compiler has no idea what all the mySQL functions are, even though I've done all I can think of to point to that header file. As a sanity check, I made sure those mySQL functions are indeed in that header file; here's one as an example:
root@1234:/home# more /usr/include/mysql/mysql.h | grep mysql_init
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
MYSQL * STDCALL mysql_init(MYSQL *mysql);
root@1234:/home#
So while I've pointed the compiler to the mysql.h header file in both my code AND with the "-I" option, it still has no clue what those 'mysql' functions are. The "-I" option was the solution in the previous post, but is not working for me here.
So... What might be the problem? I'm assuming this isn't a compiling problem, but maybe a linking one? In other words, I'm showing GCC where the mysql.h file is, but he is still not using it when processing the code?
mysql c gcc compiler-errors shared-libraries
add a comment |
I'd like to build on this post, because my symptoms are identical, but the solution seems to be something else.
I am working in a Ubuntu container (Ubuntu 16.04.3 LTS), trying to compile a toy C program that will eventually connect to an SQL server. First things first: I have the latest libmysqlclient-dev installed:
root@1234:/home# apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 88 not upgraded.
root@1234:/home#
And when I look in the /usr/include/mysql directory, I see the critical header file I'll need:
root@1234:/home# ls -l /usr/include/mysql | grep mysql.h
-rw-r--r-- 1 root root 29207 Oct 4 05:48 /usr/include/mysql/mysql.h
root@1234:/home#
So far, so good. Now I found this little toy program from here:
#include <stdio.h>
#include "/usr/include/mysql/mysql.h"
int main() {
MYSQL mysql;
if(mysql_init(&mysql)==NULL) {
printf("nInitialization errorn");
return 0;
}
mysql_real_connect(&mysql,"localhost","user","pass","dbname",0,NULL,0);
printf("Client version: %s",mysql_get_client_info());
printf("nServer version: %s",mysql_get_server_info(&mysql));
mysql_close(&mysql);
return 1;
}
Now, following the advice of the previous post, I compile using the "-I" option to point to the mysql.h header file. (Yes, I am required to use GCC here):
root@1234:/home# gcc -I/usr/include/mysql sqlToy.c
/tmp/cc8c5JmT.o: In function `main':
sqlToy.c:(.text+0x25): undefined reference to `mysql_init'
sqlToy.c:(.text+0x69): undefined reference to `mysql_real_connect'
sqlToy.c:(.text+0x72): undefined reference to `mysql_get_client_info'
sqlToy.c:(.text+0x93): undefined reference to `mysql_get_server_info'
sqlToy.c:(.text+0xb4): undefined reference to `mysql_close'
collect2: error: ld returned 1 exit status
root@1234:/home#
Belly flop! The compiler has no idea what all the mySQL functions are, even though I've done all I can think of to point to that header file. As a sanity check, I made sure those mySQL functions are indeed in that header file; here's one as an example:
root@1234:/home# more /usr/include/mysql/mysql.h | grep mysql_init
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
MYSQL * STDCALL mysql_init(MYSQL *mysql);
root@1234:/home#
So while I've pointed the compiler to the mysql.h header file in both my code AND with the "-I" option, it still has no clue what those 'mysql' functions are. The "-I" option was the solution in the previous post, but is not working for me here.
So... What might be the problem? I'm assuming this isn't a compiling problem, but maybe a linking one? In other words, I'm showing GCC where the mysql.h file is, but he is still not using it when processing the code?
mysql c gcc compiler-errors shared-libraries
I see no-l
option in your gcc line,-I
is used to specify additional directories to search for header files. Furhtermore-l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem,ld
is the linker.
– yano
Nov 12 '18 at 18:30
add a comment |
I'd like to build on this post, because my symptoms are identical, but the solution seems to be something else.
I am working in a Ubuntu container (Ubuntu 16.04.3 LTS), trying to compile a toy C program that will eventually connect to an SQL server. First things first: I have the latest libmysqlclient-dev installed:
root@1234:/home# apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 88 not upgraded.
root@1234:/home#
And when I look in the /usr/include/mysql directory, I see the critical header file I'll need:
root@1234:/home# ls -l /usr/include/mysql | grep mysql.h
-rw-r--r-- 1 root root 29207 Oct 4 05:48 /usr/include/mysql/mysql.h
root@1234:/home#
So far, so good. Now I found this little toy program from here:
#include <stdio.h>
#include "/usr/include/mysql/mysql.h"
int main() {
MYSQL mysql;
if(mysql_init(&mysql)==NULL) {
printf("nInitialization errorn");
return 0;
}
mysql_real_connect(&mysql,"localhost","user","pass","dbname",0,NULL,0);
printf("Client version: %s",mysql_get_client_info());
printf("nServer version: %s",mysql_get_server_info(&mysql));
mysql_close(&mysql);
return 1;
}
Now, following the advice of the previous post, I compile using the "-I" option to point to the mysql.h header file. (Yes, I am required to use GCC here):
root@1234:/home# gcc -I/usr/include/mysql sqlToy.c
/tmp/cc8c5JmT.o: In function `main':
sqlToy.c:(.text+0x25): undefined reference to `mysql_init'
sqlToy.c:(.text+0x69): undefined reference to `mysql_real_connect'
sqlToy.c:(.text+0x72): undefined reference to `mysql_get_client_info'
sqlToy.c:(.text+0x93): undefined reference to `mysql_get_server_info'
sqlToy.c:(.text+0xb4): undefined reference to `mysql_close'
collect2: error: ld returned 1 exit status
root@1234:/home#
Belly flop! The compiler has no idea what all the mySQL functions are, even though I've done all I can think of to point to that header file. As a sanity check, I made sure those mySQL functions are indeed in that header file; here's one as an example:
root@1234:/home# more /usr/include/mysql/mysql.h | grep mysql_init
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
MYSQL * STDCALL mysql_init(MYSQL *mysql);
root@1234:/home#
So while I've pointed the compiler to the mysql.h header file in both my code AND with the "-I" option, it still has no clue what those 'mysql' functions are. The "-I" option was the solution in the previous post, but is not working for me here.
So... What might be the problem? I'm assuming this isn't a compiling problem, but maybe a linking one? In other words, I'm showing GCC where the mysql.h file is, but he is still not using it when processing the code?
mysql c gcc compiler-errors shared-libraries
I'd like to build on this post, because my symptoms are identical, but the solution seems to be something else.
I am working in a Ubuntu container (Ubuntu 16.04.3 LTS), trying to compile a toy C program that will eventually connect to an SQL server. First things first: I have the latest libmysqlclient-dev installed:
root@1234:/home# apt install libmysqlclient-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libmysqlclient-dev is already the newest version (5.7.24-0ubuntu0.16.04.1).
0 upgraded, 0 newly installed, 0 to remove and 88 not upgraded.
root@1234:/home#
And when I look in the /usr/include/mysql directory, I see the critical header file I'll need:
root@1234:/home# ls -l /usr/include/mysql | grep mysql.h
-rw-r--r-- 1 root root 29207 Oct 4 05:48 /usr/include/mysql/mysql.h
root@1234:/home#
So far, so good. Now I found this little toy program from here:
#include <stdio.h>
#include "/usr/include/mysql/mysql.h"
int main() {
MYSQL mysql;
if(mysql_init(&mysql)==NULL) {
printf("nInitialization errorn");
return 0;
}
mysql_real_connect(&mysql,"localhost","user","pass","dbname",0,NULL,0);
printf("Client version: %s",mysql_get_client_info());
printf("nServer version: %s",mysql_get_server_info(&mysql));
mysql_close(&mysql);
return 1;
}
Now, following the advice of the previous post, I compile using the "-I" option to point to the mysql.h header file. (Yes, I am required to use GCC here):
root@1234:/home# gcc -I/usr/include/mysql sqlToy.c
/tmp/cc8c5JmT.o: In function `main':
sqlToy.c:(.text+0x25): undefined reference to `mysql_init'
sqlToy.c:(.text+0x69): undefined reference to `mysql_real_connect'
sqlToy.c:(.text+0x72): undefined reference to `mysql_get_client_info'
sqlToy.c:(.text+0x93): undefined reference to `mysql_get_server_info'
sqlToy.c:(.text+0xb4): undefined reference to `mysql_close'
collect2: error: ld returned 1 exit status
root@1234:/home#
Belly flop! The compiler has no idea what all the mySQL functions are, even though I've done all I can think of to point to that header file. As a sanity check, I made sure those mySQL functions are indeed in that header file; here's one as an example:
root@1234:/home# more /usr/include/mysql/mysql.h | grep mysql_init
libmysqlclient (exactly, mysql_server_init() is called by mysql_init() so
MYSQL * STDCALL mysql_init(MYSQL *mysql);
root@1234:/home#
So while I've pointed the compiler to the mysql.h header file in both my code AND with the "-I" option, it still has no clue what those 'mysql' functions are. The "-I" option was the solution in the previous post, but is not working for me here.
So... What might be the problem? I'm assuming this isn't a compiling problem, but maybe a linking one? In other words, I'm showing GCC where the mysql.h file is, but he is still not using it when processing the code?
mysql c gcc compiler-errors shared-libraries
mysql c gcc compiler-errors shared-libraries
asked Nov 12 '18 at 18:18
Pete
438417
438417
I see no-l
option in your gcc line,-I
is used to specify additional directories to search for header files. Furhtermore-l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem,ld
is the linker.
– yano
Nov 12 '18 at 18:30
add a comment |
I see no-l
option in your gcc line,-I
is used to specify additional directories to search for header files. Furhtermore-l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem,ld
is the linker.
– yano
Nov 12 '18 at 18:30
I see no
-l
option in your gcc line, -I
is used to specify additional directories to search for header files. Furhtermore -l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem, ld
is the linker.– yano
Nov 12 '18 at 18:30
I see no
-l
option in your gcc line, -I
is used to specify additional directories to search for header files. Furhtermore -l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem, ld
is the linker.– yano
Nov 12 '18 at 18:30
add a comment |
1 Answer
1
active
oldest
votes
Headers are not libraries. You are including the MySQL header during compilation, so these functions are defined, but you are not linking against the library which actually provides those functions.
These functions are provided by the libmysqlclient
library, so you need to add the -lmysqlclient
flag to your command line to fix this. (Note that this is a lower-case l
, not an I
.)
Additionally, since you are adding /usr/include/mysql
to your system header path, you can include the library as
#include <mysql.h>
You do not need to -- and should not! -- specify the full path to the library in the #include
directive.
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267923%2fc-code-using-gcc-cannot-link-to-mysql-header%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Headers are not libraries. You are including the MySQL header during compilation, so these functions are defined, but you are not linking against the library which actually provides those functions.
These functions are provided by the libmysqlclient
library, so you need to add the -lmysqlclient
flag to your command line to fix this. (Note that this is a lower-case l
, not an I
.)
Additionally, since you are adding /usr/include/mysql
to your system header path, you can include the library as
#include <mysql.h>
You do not need to -- and should not! -- specify the full path to the library in the #include
directive.
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
add a comment |
Headers are not libraries. You are including the MySQL header during compilation, so these functions are defined, but you are not linking against the library which actually provides those functions.
These functions are provided by the libmysqlclient
library, so you need to add the -lmysqlclient
flag to your command line to fix this. (Note that this is a lower-case l
, not an I
.)
Additionally, since you are adding /usr/include/mysql
to your system header path, you can include the library as
#include <mysql.h>
You do not need to -- and should not! -- specify the full path to the library in the #include
directive.
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
add a comment |
Headers are not libraries. You are including the MySQL header during compilation, so these functions are defined, but you are not linking against the library which actually provides those functions.
These functions are provided by the libmysqlclient
library, so you need to add the -lmysqlclient
flag to your command line to fix this. (Note that this is a lower-case l
, not an I
.)
Additionally, since you are adding /usr/include/mysql
to your system header path, you can include the library as
#include <mysql.h>
You do not need to -- and should not! -- specify the full path to the library in the #include
directive.
Headers are not libraries. You are including the MySQL header during compilation, so these functions are defined, but you are not linking against the library which actually provides those functions.
These functions are provided by the libmysqlclient
library, so you need to add the -lmysqlclient
flag to your command line to fix this. (Note that this is a lower-case l
, not an I
.)
Additionally, since you are adding /usr/include/mysql
to your system header path, you can include the library as
#include <mysql.h>
You do not need to -- and should not! -- specify the full path to the library in the #include
directive.
answered Nov 12 '18 at 18:30
duskwuff
146k19177232
146k19177232
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
add a comment |
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
Ah, that makes a LOT of sense. I have a lot to learn.
– Pete
Nov 12 '18 at 19:03
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
I've since changed my #include statement to this: #include <mysql.h>
– Pete
Nov 12 '18 at 19:04
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
and now I compile with this: [[ gcc -lmysqlclient sqlToy.c ]] and get this compilation error: [[ sqlToy.c:2:19: fatal error: mysql.h: No such file or directory ]] Variations on this command give the earlier error... I'm close, just missing something fundamental...
– Pete
Nov 12 '18 at 19:06
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
Ah HA!!! Thanks to duskwuff and yano's comments, I figured out the syntax: [[ gcc -Wall sqlToy.c -lmysqlclient ]] Nice! Thank you!!!
– Pete
Nov 12 '18 at 19:22
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53267923%2fc-code-using-gcc-cannot-link-to-mysql-header%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I see no
-l
option in your gcc line,-I
is used to specify additional directories to search for header files. Furhtermore-l
is used to link in a library, not header files. The actual mysql binary code is somewhere in a library (or multiple libraries), it's that library that needs to get linked in. That's different from a header file. You are correct, it is a linking problem,ld
is the linker.– yano
Nov 12 '18 at 18:30