[Lugge] linkare moduli C++ in un main C

  • From: Roberto A.Foglietta <fogliettar@xxxxxxxxxxxxxxxxxx>
  • To: LUGGE <lugge@xxxxxxxxxxxxx>
  • Date: Mon, 6 May 2002 11:35:53 +0200

Ciao,

 ho riscontrato problemi nel linkare moduli C++ dentro un main C del tipo

 -----main.c-----
 #include mio.h
 main()
 {
   char *c;
   int i;
   void *p;

   mia_func(c, i, p);
 }

 ----miafun.cpp---

 int miafunc(char *c,int i, void *p) {
  <codice cpp>
 }

[roberto@rafhost src]$ c++  -g -O2  -o cockpit  simple.o widgets.o drawing.o 
iofile.o sclient.o socket/socket.a -lm -ldirectfb  simple.o: In function `main':
/home/roberto/Projects/cockpit-1.0/src/simple.c:313: undefined reference to 
`socket_client'
collect2: ld returned 1 exit status

 Esattamente lo stesso errore che ottengo se tolgo il modulo C++ che contiene 
quella funzione
 
[roberto@rafhost src]$ c++  -g -O2  -o cockpit  simple.o widgets.o drawing.o 
iofile.o  socket/socket.a -lm -ldirectfb simple.o: In function `main':
/home/roberto/Projects/cockpit-1.0/src/simple.c:313: undefined reference to 
`socket_client'
collect2: ld returned 1 exit status

 Qualcuno puo` aiutarmi per favore?

 Grazie,
-- 
   ,__    ,_     ,___   .-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-.
   ||_)   ||\    ||_   /            GEA Automotive S.R.L.             |
   || \   ||¯\   ||¯        Software Research & Develop Division      |
   ¯¯  ¯° ¯¯  ¯° ¯¯  °   tel.: +39 010 65966917                       |  
   Roberto A. Foglietta  com.: mailto:fogliettar@xxxxxxxxxxxxxxxxxx   |
 \ Linux & SW Architect  per.: http://digilander.iol.it/robang        |
  `-----------------------=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-'

<========----------
 Prima di scrivere in m-list per favore leggi il regolamento
 http://lugge.ziobudda.net/soci/manifesto.htm#list

 Archivio delle e-mail postate in lista
 //www.freelists.org/archives/lugge/

----------========>
 Incontri in sede: martedì 15:00-18:00 e sabato 9:30-12.30
 

Other related posts: