Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Linker error

Status
Not open for further replies.

thegame8311

Technical User
Jan 6, 2012
133
US
I have been all over the place with this and I can't seem to get past the linker errors, and this last one is getting to me

fatal error LNK1104: cannot open file 'C:\Program Files\MySQL\MySQL Server 5.5\lib\\.obj'

here is the code:
Code:
// Test2.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <urlmon.h>
#include <iostream>
#include <tchar.h>
#include <fstream>
#include <string>
#include <sqlext.h>

#include <stdlib.h>
#include <stddef.h>

#include <winsock.h>
#include <cstdio>
#include <mysql.h>

#pragma comment (lib, "urlmon.lib")
//#pragma comment (lib, "libmysql.lib")
using namespace std;
void ProcsLink(string plink);
string Team_Name(string team);
string PName(string name);
void Playerfunc();

int _tmain(int argc, _TCHAR* argv[])
{
	system("del LivePlayers.txt");
	Playerfunc();
	system("del testA.txt");
	system("del testB.txt");


	// create a pointer of the type mysql
MYSQL *conn;
// initialize your mysql connection
conn = mysql_init(NULL);
// connect to your database
mysql_real_connect(conn,"localhost","username","password","database",0,NULL,0);
// perform a query
mysql_query(conn,"UPDATE my_table SET somevalue = somevalue + 1 WHERE id = 5");
// close the connection
mysql_close(conn);
}

This has been driving me nuts I have include the lib and include from mysql folder, so what is going on?
 
This is not really a MYSQL error as MYSQL isn't involved there yet. It is a C++ error when trying to load a file in that directory.

From what I can find it seems that you need to quote directory paths that have spaces in them such as the Program Files directory and MYSQL directory because spaces can cause issues.





----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
there are not any obj files in the directory and I just quoted it and it still gave the same problem. Also when I temporaryly took that link out it gave me all the things it checked and at the end was this:

Code:
1>Test2.obj : error LNK2019: unresolved external symbol _mysql_close@4 referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol _mysql_query@8 referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function _main
1>Test2.obj : error LNK2019: unresolved external symbol _mysql_init@4 referenced in function _main
1>C:\Users\Sasuke\documents\visual studio 2010\Projects\Test2\Debug\Test2.exe : fatal error LNK1120: 4 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
Still not a MYSQL issue. I'm not very familiar with Visual Studio though so can't really offer much advice there.

Perhaps reading through this may offer some help:

Also posting in forum116 may yield better results.


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top