Aller au contenu
Règlement du forum ×
IPTV et arnaques ×

Qt4


abitaf

Messages recommandés

je suis entrain de programmer une application avec QT4 et g une librairie que g programmer en C g bien rajouter dans le header mabib.h :

 

#ifdef __cplusplus

extern "C" {

#endif

 

#endif

#ifdef __cplusplus

}

 

mais g toujours un pbm lors du linkage indefined reference to ... qqn a une idée :confused:

Modifié par abitaf
Lien vers le commentaire
Partager sur d’autres sites

#ifndef LIB_MAQAO

#define LIB_MAQAO

 

#ifdef __cplusplus

extern "C" {

#endif

 

extern int project_create();

 

extern int project_open(char* projectfile);

 

extern int project_save(char* filename);

 

extern int project_close();

 

extern int project_asmfile_count();

 

extern char *project_asmfile_get(int index);

 

extern char *load(char *filename);

 

extern char* db_filename(char *asmfile);

 

extern char* source_filename(char * asmfile);

 

extern int unload(char * asmfile);

 

extern int get_block_lines(char *asmfile, int blockid, int *srcline);

 

extern int function_count(char *asmfile);

 

extern char *function_iter(char *asmfile);

 

extern char *get_function_name(char *asmfile,int id);

 

extern int print_assembly(char* asmfile, char* filename);

 

extern int print_decorated();

 

extern char* save_project_call_graph();

 

extern char* save_call_graph(char *asmfile);

 

extern char* save_control_flow_graph(char *asmfile, int function_global_id, int type);

 

extern char* save_ddg(char *asmfile, char *blocks,int length);

 

extern int instrumenter_command(char* asmfile, char command, char* arg1);

 

extern char *ii_cmd(char *buff);

 

extern void ii_load_file(char *file);

 

extern void ii_init(void);

 

extern void ii_init_batch(int shellinit);

 

extern void oracle_init();

 

extern void oracle_execute(char *asmfilename);

 

extern void oracle_set_current_filename(char *assemblyfilename);

 

extern void ddg_init();

 

extern void ddg_execute(char *asmfilename, char *blocks,int length,int mode);

 

 

#ifdef __cplusplus

}

#endif

 

#endif /* LIB_MAQAO */

Lien vers le commentaire
Partager sur d’autres sites

#ifndef LIB_MAQAO

#define LIB_MAQAO

 

#ifdef __cplusplus

extern "C" {

#endif

 

extern int project_create();

 

extern int project_open(char* projectfile);

 

extern int project_save(char* filename);

 

extern int project_close();

 

extern int project_asmfile_count();

 

extern char *project_asmfile_get(int index);

 

extern char *load(char *filename);

 

extern char* db_filename(char *asmfile);

 

extern char* source_filename(char * asmfile);

 

extern int unload(char * asmfile);

 

extern int get_block_lines(char *asmfile, int blockid, int *srcline);

 

extern int function_count(char *asmfile);

 

extern char *function_iter(char *asmfile);

 

extern char *get_function_name(char *asmfile,int id);

 

extern int print_assembly(char* asmfile, char* filename);

 

extern int print_decorated();

 

extern char* save_project_call_graph();

 

extern char* save_call_graph(char *asmfile);

 

extern char* save_control_flow_graph(char *asmfile, int function_global_id, int type);

 

extern char* save_ddg(char *asmfile, char *blocks,int length);

 

extern int instrumenter_command(char* asmfile, char command, char* arg1);

 

extern char *ii_cmd(char *buff);

 

extern void ii_load_file(char *file);

 

extern void ii_init(void);

 

extern void ii_init_batch(int shellinit);

 

extern void oracle_init();

 

extern void oracle_execute(char *asmfilename);

 

extern void oracle_set_current_filename(char *assemblyfilename);

 

extern void ddg_init();

 

extern void ddg_execute(char *asmfilename, char *blocks,int length,int mode);

 

 

#ifdef __cplusplus

}

#endif

 

#endif /* LIB_MAQAO */

 

The header looks fine. Without seeing the code and what you're trying to do I cannot be of big help. Undefined reference means that one/multiple functions were defined but never implemented.

 

What is the exact error message you're getting?

Lien vers le commentaire
Partager sur d’autres sites

project_create() est définie dans libmaqao.c qui est compilé avec gcc pour produire libmaqao.so que je lie avec mon projet Qt4 -L/home/abitaf/local/lib

il n'y a pas d'erreur de compilation l'erreur elle est a l'édition de lien ?

 

 

Try to include libmaqao.c in your project since you already added the extern directive, the c++ compiler will recognize it as c code.

Lien vers le commentaire
Partager sur d’autres sites

libmaqao est composé de plusieurs source voici le makefile :

 

ficihier Makefile.config :

### Executables

 

CC=gcc

DOXYGEN=/usr/bin/doxygen

SWIG=/usr/bin/swig

LEX=/usr/bin/flex

YACC=/usr/bin/bison

SQLITE=/usr/bin/sqlite3

 

### Flags

LEXLIB=-lfl

CFLAGS=-O2 -Wall -I. -I.. -DDEBUG -g -O2 -I/home/abitaf/local/include -I/usr/include/lua5.1 -D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBIAN -fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl/5.8/CORE

LDFLAGS= -L/home/abitaf/local/lib -lm -L. -lm -llua5.1 -lsqlite3 -ldl -lmhash

 

fichier Makefile :

############################################################################

############################################################################

include ../Makefile.config

 

CFLAGS += $(EXTRA_FLAGS)

 

SRCS=type.c sqlite.c file.c asm.c flow_graph.c dominance.c lex.mir.c mir.tab.c instrumenter.c hotpath.c md5.c parser.c printer.c printer_common.c \

ia64/lexer.c ia64/printer.c ia64/printer_tools.c ia32/lexer.c ia32/printer.c \

ia64/libii64.c ia32/libii32.c

 

LIBOBJ=ia32/lex.ia32.o ia64/lex.ia64.o ia64/lex.ia64dump.o libmaqao.o ia32/libii32.o ia64/libii64.o libii.o

 

SUBDIRS=ia32 ia64

 

all:

@for i in $(SUBDIRS); \

do \

cd $$i && $(MAKE) || exit 1; cd ..; \

done

$(MAKE) libmaqao.so maqao-parser maqao-instrumenter

 

.PHONY: all doc clean

 

maqao-parser: maqao.o libmaqao.so

$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -L. -lmaqao -pg

 

maqao-instrumenter: maqaoinstru.o libmaqao.so

$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ -L. -lmaqao -pg

 

libmaqao.so: $(SRCS:%.c=%.o) $(LIBOBJ)

$(CC) -shared -o $@ $^ $(LDFLAGS) $(LEXLIB) -pg

 

doc: ${SRCS:%.c=%.h} libmaqao.h Doxyfile

$(DOXYGEN) Doxyfile

 

clean:

@for i in $(SUBDIRS); \

do \

cd $$i && $(MAKE) clean && cd ..; \

done

-@rm -f *.o *~ *.so mir.tab.c mir.tab.h lex.mir.c maqao-instrumenter maqao-parser

 

distclean:

-@rm -f config.h

 

lex.mir.c: mir.l mir.tab.h

${LEX} -Pmir mir.l

 

mir.tab.h:mir.tab.c # fake dependency

 

mir.tab.c: mir.y hotpath.h sqlite.h

${YACC} -d -p mir -o mir.tab.c mir.y

 

type.o: type.h

sqlite.o: debug.h type.h asm.h sqlite.h file.h

asm.o: debug.h asm.h type.h

md5.o: md5.h

file.o: file.h config.h

flow_graph.o: debug.h asm.h type.h flow_graph.h

dominance.o: debug.h asm.h type.h flow_graph.h dominance.h

sqlite.o: debug.h asm.h type.h flow_graph.h dominance.h sqlite.h ../sql/create.sql

libmaqao.o: asm.h flow_graph.h printer.h parser.h dominance.h sqlite.h file.h libii.h

hotpath.o: hotpath.h asm.h debug.h type.h

instrumenter.o:instrumenter.h mir.tab.h

 

question : est-ce que je doit compiler libmaqao avec g++ ? normalement il est possible de lié un code compilé avec g++ avec une libraire compilé avec gcc ?

Lien vers le commentaire
Partager sur d’autres sites

merci pour l'aide je vien de resoudre le probleme moi je rajouter ma bib avec :

g++ -L/home/abitaf/local/lib

 

au lieu de ca il faut faire :

g++ -L/home/abitaf/local/lib -lmaqao :)

 

maintenant je passe a un autre problème g un composent QTextEdit dans ma fenêtre pour l'édition de source je voudrai qu'il m'affiche le numéro de la ligne a gauche qqn a une idée g trouvé des source qui font sa mais en complique il définisse un composant personnalisé avec l'héritage et redéfinisse plein de fonction moi je veux quelque chose de simple

 

encore merci beaucoup :D

Lien vers le commentaire
Partager sur d’autres sites

Rejoindre la conversation

Vous pouvez publier maintenant et vous inscrire plus tard. Si vous avez un compte, connectez-vous maintenant pour publier avec votre compte.

Invité
Répondre à ce sujet…

×   Collé en tant que texte enrichi.   Coller en tant que texte brut à la place

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

×
×
  • Créer...