Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » make file for library
make file for library [message #127408] Tue, 16 November 2004 17:51 Go to next message
Eclipse UserFriend
I have written a simple C++ class.
I want it to server as a library (not an executable) on both windows and
linux platforms. Currently the make file is written as for creating an
executable (below). How can I modify it so that it creates a library.
MyTest.exe : MyTest.o
g++ -o MyTest.exe MyTest.o

MyTest.o : MyTest.cpp
g++ -c MyTest.cpp

all : MyTest.exe
clean :
-rm MyTest.exe MyTest.o
Re: make file for library [message #127652 is a reply to message #127408] Thu, 18 November 2004 04:24 Go to previous messageGo to next message
Eclipse UserFriend
Al wrote:

> I have written a simple C++ class.
> I want it to server as a library (not an executable) on both windows and
> linux platforms. Currently the make file is written as for creating an
> executable (below). How can I modify it so that it creates a library.
> MyTest.exe : MyTest.o
> g++ -o MyTest.exe MyTest.o

> MyTest.o : MyTest.cpp
> g++ -c MyTest.cpp

> all : MyTest.exe
> clean :
> -rm MyTest.exe MyTest.o

Here is makefile for library

libMyTest.a : MyTest.o
ar -rc libMyTest.a MyTest.o

MyTest.o : MyTest.cpp
g++ -c MyTest.cpp

all : MyTest.a
clean :
-rm libMyTest.a MyTest.o

CC Vural
Re: make file for library [message #127665 is a reply to message #127408] Thu, 18 November 2004 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: johan.nosp.m.appeal.se

Creating libraries in a platform independent fashion is a mess.

You could use Libtool (which will probably force you into Automake and Autoconf
as well), but that isn't without a certain threshold either.

Anyway, you'll probably have to study to build your cross platform library.
Good luck :-).

Regards //Johan

Al wrote / skrev:
> I have written a simple C++ class.
> I want it to server as a library (not an executable) on both windows and
> linux platforms. Currently the make file is written as for creating an
> executable (below). How can I modify it so that it creates a library.
> MyTest.exe : MyTest.o
> g++ -o MyTest.exe MyTest.o
>
> MyTest.o : MyTest.cpp
> g++ -c MyTest.cpp
>
> all : MyTest.exe
> clean :
> -rm MyTest.exe MyTest.o
>
Re: make file for library [message #127745 is a reply to message #127652] Thu, 18 November 2004 14:56 Go to previous messageGo to next message
Eclipse UserFriend
CC,
Thank you , but it doesn't seem to work
It doesn't like the 2nd line, but it doesn't say why,
there is just a red X on the left.
Does that line look correct to you?

Cavit Cahit VURAL wrote:

> Al wrote:

>> I have written a simple C++ class.
>> I want it to server as a library (not an executable) on both windows and
>> linux platforms. Currently the make file is written as for creating an
>> executable (below). How can I modify it so that it creates a library.
>> MyTest.exe : MyTest.o
>> g++ -o MyTest.exe MyTest.o

>> MyTest.o : MyTest.cpp
>> g++ -c MyTest.cpp

>> all : MyTest.exe
>> clean :
>> -rm MyTest.exe MyTest.o

> Here is makefile for library

> libMyTest.a : MyTest.o
> ar -rc libMyTest.a MyTest.o

> MyTest.o : MyTest.cpp
> g++ -c MyTest.cpp

> all : MyTest.a
> clean :
> -rm libMyTest.a MyTest.o

> CC Vural
makefile:2: *** missing separator. Stop. [message #127770 is a reply to message #127745] Thu, 18 November 2004 15:09 Go to previous messageGo to next message
Eclipse UserFriend
oh, here's the error:
make -k all
makefile:2: *** missing separator. Stop.

(I was looking under the Problems tab, this is in the Console tab)

What does this mean?
Googling doesn't help much
Re: makefile:2: *** missing separator. Stop. [message #127822 is a reply to message #127770] Fri, 19 November 2004 02:24 Go to previous messageGo to next message
Eclipse UserFriend
Al wrote:

> oh, here's the error:
> make -k all
> makefile:2: *** missing separator. Stop.

> (I was looking under the Problems tab, this is in the Console tab)

> What does this mean?
> Googling doesn't help much

Use "TAB" at the begining of the second line.

CC Vural
Re: make file for library [message #127962 is a reply to message #127652] Fri, 19 November 2004 13:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: lothar.xcerla.com

Cavit Cahit VURAL wrote:

> Al wrote:
>
>> I have written a simple C++ class.
>> I want it to server as a library (not an executable) on both windows and
>> linux platforms. Currently the make file is written as for creating an
>> executable (below). How can I modify it so that it creates a library.

SCons is capable of building on multiple platforms.

I wrote a SCons Builder Plugin for Eclipse. Although I use only Linux it
should work on Windows, too. Fell free to give it a try.

For more information see
http://nic-nac-project.de/~lothar/eclipse/update/SConsBuilde rPlugin.html

The plugin is registed at http://eclipse-plugins.2y.net.
If you like it you can rate it at
http://eclipse-plugins.2y.net/eclipse/plugin_details.

Lothar
thank you very much [message #127986 is a reply to message #127822] Fri, 19 November 2004 18:31 Go to previous message
Eclipse UserFriend
:)
Previous Topic:change background color
Next Topic:upgrade to RedHat Fedora Core 3 broke Eclipse 3.0
Goto Forum:
  


Current Time: Mon Jun 16 21:10:25 EDT 2025

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

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

Back to the top