2

I am using Eclipse Galileo 3.5 with CDT 6.0

I am having a problem in including the header files located in c:\cs106 ... I searched on google and found that I have to go to Project Properties > C/C++ General > Paths and Symbols and in GNU C++ I have added the path c:\cs106

And eclipse is able to find them now but the other problem I am getting is that when I try to build a simple program which is using a function defined in "simpio.h" located in c:\cs106 and I have already included at the top of my program #include "simpio.h" but it is giving me an error

**** Internal Builder is used for build ****
g++ -IC:\cs106 -O0 -g3 -Wall -c -fmessage-length=0 -osrc\CS106.o ..\src\CS106.cpp
g++ -oCS106.exe src\CS106.o
src\CS106.o: In function `main':
C:/Users/User/workspace/CS106/Debug/../src/CS106.cpp:8: undefined reference to `GetInteger()'
collect2: ld returned 1 exit status
Build error occurred, build is stopped
Time consumed: 986 ms.

I googled and what I get is that I have to to tell the linker for a .lib file that is accompanied with the header files. in my case the provided .lib file is (CS106CPPLib.lib) and I checked with the project file that I got was of VS 2008 and saw that they have added the following statement in the project settings file under VCLinkerTool: AdditionalDependencies="c:\cs106\CS106CPPLib.lib winmm.lib"

So I think I have to include this CS106CPPLib.lib winmm.lib in eclipse as well but I am unable to figure out where should I do this. Please if someone can help me I will be really grateful.

If you need any more info please reply me.

Thanks

2
  • When you comment that you used winmm.lib in VC++ I would assume it's built with VC++. Are you sure you this library is in an object format, that is compatible with gnu ld? Probably you need to compile it with the GNU compiler. But I am uncertain if that's necessary.
    – harper
    Oct 19, 2012 at 10:54
  • Hi @Ahmed; support the proposal by clicking commit area51.stackexchange.com/proposals/75879/… Dec 14, 2014 at 13:42

2 Answers 2

1

It looks like a linker error, it has nothing to do with the header. You now need to link the library in eclipse.

0

you need to define explicitly library's name in your project... in project setting somewhere if you already done that... that function is not there in library... Probably you need to add another lib file in which function's definition is there...

4
  • Thanks for your reply. I want to tell you that the functions definition is already defined in the c:\cs106\CS106CPPLib.lib winmm.lib as it is working in visual studio but I want to get it working in eclipse as I like eclipse environment very much.
    – Ahmed
    Mar 10, 2010 at 6:13
  • It clearly says that it can't find GetInteger() function anywhere... have you explicitly link winmm.lib file in your eclipse environment if not please link it explicitly... and use Absolute Path in library Path rather than relative Path these might fix the problem Mar 10, 2010 at 7:51
  • Thanks mate but I am unable to figure out how to do that.. I am an absolute beginner can you tell me how to do that.. step by step.. Thanks
    – Ahmed
    Mar 10, 2010 at 8:56
  • I have successfully linked the file you can check this screenshot but again it is giving me the error. i41.tinypic.com/16k0tj7.jpg Error ScreenShot: i43.tinypic.com/1074egm.jpg It is working perfect in Visual Studio but I want it to work in Eclipse..
    – Ahmed
    Mar 10, 2010 at 13:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.