Archived

This topic is now archived and is closed to further replies.

Weird Linker Error

This topic is 5553 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi All - I am trying to use a global include file in my workspace. I have the code : // gFile.h // // The global file of all includes. (except " " includes) #ifndef _gFile_h_ #define _gFile_h_ #include <string> using namespace std; #include <fstream> using namespace std; #include <afxwin.h> #include <afxsock.h> #include <process.h> #include <math.h> #include <gl\gl.h> #include <gl\glu.h> #include <gltools.h> #include <glframe.h> #include <stopwatch.h> #include <stdio.h> #include <viewfrustum.h> #pragma comment(lib, "opengl32.lib") #pragma comment(lib, "gltools.lib") #pragma comment(lib, "glu32.lib") #endif These are all the non local includes my workspace uses right now. However during compile i get : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpd.lib(delop.obj) I think I have a weird circle inclusion going on but I''m not sure where. If i move the string and fstream includes it gives me about 15 linker errors. I was just wondering if anybody had come across this one before. Any help would be appreciated. Thanks NextGenGamer

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
is that the only error/warning you get from the linker?

Share this post


Link to post
Share on other sites
What I would recommend is removing the command "using namespace std;" from your global include file and only specify it in the files that use std:: streams. Another problem could be the your library files that your including. If when you built those .lib files you included ALL libs into them then what happens is that when you program is built all the normal libs are put in but when it tries to link in your extra libs it finds all these double's. If you wrote glTools.lib try rebuilding it making sure that it doesn't contain ANY libs linked into it. That's all I can help you with. I should also note that I had a similar problem to you and I managed to fix it by simply rebuilding all the .lib files I was linking into it because I had changed my compiler, but anyway...


EDIT: Also are you trying to overload the delete operator in one of you .cpp,.c and .h files. That could also cause a problem.



From a FLOOP (Freak, and LOVING it, of Object Oriented Programming)

[edited by - RamboBones on October 1, 2002 8:30:03 PM]

Share this post


Link to post
Share on other sites