|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
[C] Da Makefile a progetto
Salva a tutti, vorrei chiedervi un aiutino su come passare da un Makefile gia esistente ad un "progetto" realizzato con qualsiasi programma. In particolare il Makefile compila anche delle librerie; come posso "allegare" queste librerie nel file project dove invece io vorrei mettere solo il programma mio? Le librerie non vengono modificate e di conseguenza non ho l'esigenza di doverle ricompilare ogni volta.
PS Il tutto nasce dal desiderio sfruttare "meglio" le comodità di IDE fornite da MSV o Eclipse. Grazie
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Se le librerie non le devi ricompilare basta linkarle dalle opzioni del progetto. Solitamente ci sono delle opzioni relative al linker, basta mettere il percorso del file .lib o .a
|
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
Grazie cionci, adesso inoltre dovrei aggiungere i file obj. Ho cercato su internet è l'unica cosa che ho trovato è stata quella di fare(con VisualStudio) add existing item. Sai darmi qualche ulteriore aiuto.
Ti posto il Makefile originale e ti dico le cose che credo siano necessarie per far girare il file lmdemo, cioè quello che poi diventerà il mio main: lm.obj Axb.obj misc.obj lmlec.obj lmbc.obj lmblec.obj levmar.lib Adesso se lancio la compilazione mi trova un errore nel main(error C2440: '=' : cannot convert from 'void *' to 'double *') mentre se faccio con nmake va tutto liscio. Cosa mi sto dimenticando? Grazie Codice:
# # MS Visual C Makefile for Levenberg - Marquardt minimization # Under Unix/Linux, use Makefile for GCC # # At the command prompt, type # nmake /f Makefile.vc # # NOTE: To use this, you must have MSVC installed and properly # configured for command line use (you might need to run VCVARS32.BAT # included with your copy of MSVC). Another option is to use the # free MSVC toolkit from http://msdn.microsoft.com/visualc/vctoolkit2003/ # MAKE=nmake /nologo CC=cl /nologo CONFIGFLAGS=#/ULINSOLVERS_RETAIN_MEMORY CFLAGS=$(CONFIGFLAGS) /I. /MD /W3 /EHsc /O2 $(SPOPTFLAGS) # /Wall LAPACKLIBS_PATH=C:\src\lib LDFLAGS=/link /subsystem:console /opt:ref /libpath:$(LAPACKLIBS_PATH) /libpath:. LIBOBJS=lm.obj Axb.obj misc.obj lmlec.obj lmbc.obj lmblec.obj LIBSRCS=lm.c Axb.c misc.c lmlec.c lmbc.c lmblec.c DEMOBJS=lmdemo.obj DEMOSRCS=lmdemo.c AR=lib /nologo # comment the following line if you are not using LAPACK #LAPACKLIBS=clapack.lib blas.lib libF77.lib libI77.lib(non ho le Lapack) LIBS=levmar.lib $(LAPACKLIBS) all: levmar.lib lmdemo.exe levmar.lib: $(LIBOBJS) $(AR) /out:levmar.lib $(LIBOBJS) lmdemo.exe: $(DEMOBJS) levmar.lib $(CC) $(DEMOBJS) $(LDFLAGS) /out:lmdemo.exe $(LIBS) lm.obj: lm.c lm_core.c lm.h misc.h compiler.h Axb.obj: Axb.c Axb_core.c lm.h misc.h misc.obj: misc.c misc_core.c lm.h misc.h lmlec.obj: lmlec.c lmlec_core.c lm.h misc.h lmbc.obj: lmbc.c lmbc_core.c lm.h misc.h compiler.h lmblec.obj: lmblec.c lmblec_core.c lm.h misc.h lmdemo.obj: lm.h clean: -del $(LIBOBJS) $(DEMOBJS) cleanall: clean -del lmdemo.exe -del levmar.lib
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Apr 2000
Città: Vicino a Montecatini(Pistoia) Moto:Kawasaki Ninja ZX-9R Scudetti: 29
Messaggi: 53971
|
Non ho Visual C++ fra le mani, non posso aiutarti.
|
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Dec 2004
Messaggi: 783
|
E se utilizzassi un'altra IDE riusciresti a darmi qualche dritta?
Grazie
__________________
"May the wind always be at your back and the sun upon your face. And may the wings of destiny carry you aloft to dance with the stars...." |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 12:57.




















