Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » Problem in linking a static library (Windows)
Problem in linking a static library (Windows) [message #694780] Sat, 09 July 2011 17:05 Go to next message
jouni.karhima is currently offline jouni.karhimaFriend
Messages: 2
Registered: July 2011
Junior Member
Hello all,

I'm a new CDT user and trying to set up a simple example of a static library and an executable that uses it. This proved to be a lot more complicated task than I expected, but after spending a good few hours working on it I have got close to my goal. At the very doorstep I'm facing still one more problem and this seems to be a little bit too much for me. So close and so far.

First I was able to build my simple library with one class. Then I created the executable project and linked my library to it using the steps i found in this CDT Shared library article (janmagnet.wordpress.com/2007/09/30/eclipse-cdt-and-shared-libraries/). A few more steps on top of that I had my basics ready, but then I still had some problems to solve.

It seems that in Windows environment the paths in the makefile starting with C: are problematic as : is a control character. This is referred at least in this current issues page (projects.coin-or.org/BuildTools/wiki/current-issues). I don't know how to change the make version within CDT and so I chose another path by disabling the automatic makefile generation and fixed the paths myself. After this phase I was successful in building the executable, where the library was linked, but not yet used.

The final step I need is to actually use the library. An attempt to do this produces the final problem I haven't been able to solve. When I build my program (Test.cpp) I get the following error

src/Test.d:1: *** multiple target patterns. Stop.

Now this is actually the same problem I solved before. It is caused by library paths that start with C: and the : character is the problem. But this time the problem is not located anymore in the makefile, but instead in Test.d file, which I understand is some temporary file created at some compilation stage. Now I have no idea how to fix that. I don't understand the compilation process well enough to know if I'm able to affect on how the paths are presented in this file. So I'm stuck.

I see two alternatives to proceed:

1) I follow the instructions of my second link and fix the make version. This would propably be the better solution, but is it possible for me to change the CDT build-in make version?

2) I find yet another work-around that also fixes the paths in the .d file. But I don't know where to look for that or is it even possible?

Any responses are welcome.

[Updated on: Sat, 09 July 2011 17:05]

Report message to a moderator

Re: Problem in linking a static library (Windows) [message #695400 is a reply to message #694780] Mon, 11 July 2011 16:30 Go to previous messageGo to next message
Edzard Egberts is currently offline Edzard EgbertsFriend
Messages: 57
Registered: July 2009
Member
forums-noreply@eclipse.org schrieb:
> It seems that in Windows environment the paths in the makefile starting
> with C: are problematic as : is a control character.

Maybe it works, when you are using workspace-paths and not filesystem
paths. Don't enter them by keyboard, but use button [workspace].

> The final step I need is to actually use the library. An attempt to do
> this produces the final problem I haven't been able to solve. When I
> build my program (Test.cpp) I get the following error
>
> src/Test.d:1: *** multiple target patterns. Stop.
>
> Now this is actually the same problem I solved before.

Yes, but it can be caused by spaces too:

https://www-304.ibm.com/support/docview.wss?uid=swg21119863
Re: Problem in linking a static library (Windows) [message #696286 is a reply to message #695400] Wed, 13 July 2011 16:07 Go to previous messageGo to next message
jouni.karhima is currently offline jouni.karhimaFriend
Messages: 2
Registered: July 2011
Junior Member
Quote:
Maybe it works, when you are using workspace-paths and not filesystem
paths. Don't enter them by keyboard, but use button [workspace].

I can handle the paths that I can change manually. In most places I can simply begin the path with "\" instead of "C:\".

My problem are the *.d files that the compiler writes and whose content I cannot format. I tried to add a sed-command to clean the paths just before the linker is called in the makefile, but it seems that the error in *.d is found even when the linking command is in comments. So I'm not even sure where the *.d are generated and where they are used.
Re: Problem in linking a static library (Windows) [message #740241 is a reply to message #696286] Tue, 18 October 2011 09:53 Go to previous message
Sunny  is currently offline Sunny Friend
Messages: 2
Registered: October 2011
Junior Member
How to use workspace-pahts and not filesystem pahts?
I try to modify Project->Properties->C/C++ Build->Settings->Tool Settings->Cygwin C++ Compiler->Includes
delete filesystem path:"C:\systemc-2.2.0\include"
add workspace path:"/cygdrive/c/systemc-2.2.0/include/"
But it's wrong.
Anybody can help me, thanks!
Previous Topic:"Searching for Binaries" running forever
Next Topic:Scanf is jamming my console
Goto Forum:
  


Current Time: Fri Apr 26 08:27:00 GMT 2024

Powered by FUDForum. Page generated in 0.02501 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top