Executer un prgme c linux
yuri648
Messages postés
677
Date d'inscription
Statut
Membre
Dernière intervention
-
yuri648 Messages postés 677 Date d'inscription Statut Membre Dernière intervention -
yuri648 Messages postés 677 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je traivail sur ubuntu 10 ,j'ai installé pvm par gestionnaire des paquets synaptic, comment executer un programme c qui contients des instruction pvm par exemple
#include "pvm3.h"
int main() {
int ptid;
char buf[55];
ptid = pvm_parent();
strcpy(buf, "bonjour, depuis la machine ");
gethostname(buf + strlen(buf), 25);
pvm_initsend(PvmDataDefault);
pvm_pkstr(buf);
pvm_send(ptid, 1);
pvm_exit();
exit(0);
}
merci
je traivail sur ubuntu 10 ,j'ai installé pvm par gestionnaire des paquets synaptic, comment executer un programme c qui contients des instruction pvm par exemple
#include "pvm3.h"
int main() {
int ptid;
char buf[55];
ptid = pvm_parent();
strcpy(buf, "bonjour, depuis la machine ");
gethostname(buf + strlen(buf), 25);
pvm_initsend(PvmDataDefault);
pvm_pkstr(buf);
pvm_send(ptid, 1);
pvm_exit();
exit(0);
}
merci
A voir également:
- Executer un prgme c linux
- Linux reader - Télécharger - Stockage
- Toutou linux - Télécharger - Systèmes d'exploitation
- Backtrack linux - Télécharger - Sécurité
- R-linux - Télécharger - Sauvegarde
- Linux mint 22.1 - Accueil - Linux
7 réponses
Les systèmes GNU/Linux(Ubuntu inclut) contient un compilateur C, c'est la commande gcc, pour savoir plus tape
man gccdans le terminal, sinon il y a d'autres compilateurs comme Code::Blocks(Il est disponible dans le logithèque Ubuntu) ou NetBeans(il est disponible aussi dans le logithèque MAIS à mon avis ç'est mieux de la télécharger à partir du site web officiel)
merci de me repondre mais quand je compile mon programme j'ai des erreurs
voici les erreurs
hello.c:1:18: error: pvm3.h: Aucun fichier ou dossier de ce type
hello.c: In function `main':
hello.c:9: warning: incompatible implicit declaration of built-in function `strcpy'
hello.c:10: warning: incompatible implicit declaration of built-in function `strlen'
hello.c:12: error: `PvmDataDefault' undeclared (first use in this function)
hello.c:12: error: (Each undeclared identifier is reported only once
hello.c:12: error: for each function it appears in.)
hello.c:17: warning: incompatible implicit declaration of built-in function `exit'
elle a une relation avec la configuration pvm peut etre
voici les erreurs
hello.c:1:18: error: pvm3.h: Aucun fichier ou dossier de ce type
hello.c: In function `main':
hello.c:9: warning: incompatible implicit declaration of built-in function `strcpy'
hello.c:10: warning: incompatible implicit declaration of built-in function `strlen'
hello.c:12: error: `PvmDataDefault' undeclared (first use in this function)
hello.c:12: error: (Each undeclared identifier is reported only once
hello.c:12: error: for each function it appears in.)
hello.c:17: warning: incompatible implicit declaration of built-in function `exit'
elle a une relation avec la configuration pvm peut etre
T'as mis
Par ailleur je te conseil d'installer l'un d'autres compélateur ça sera plus facile à visualiser les erreurs.
#include "pvm3.h"est ce que pvm3.h est un faichier créer par toi ou quoi?? Si oui il doit être mis dans le même répértoire que le fichier .c
Par ailleur je te conseil d'installer l'un d'autres compélateur ça sera plus facile à visualiser les erreurs.
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
As tu installé le package de développement pvm (qui contient les fichiers include nécessaires) ?
et puis il manque des include
non exhaustif....
Johan
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
johand@osiris:~/tmp$ apt-cache search pvm | grep dev libblacs-mpi-dev - Basic Linear Algebra Comm. Subprograms - Dev. files for MPI blacs-pvm-dev - Basic Linear Algebra Comm. Subprograms - Dev. files for PVM pvm-dev - Parallel Virtual Machine - development files libscalapack-mpi-dev - Scalable Linear Algebra Package - Dev. files for MPICH libscalapack-pvm-dev - Scalable Linear Algebra Package - Dev. files for PVM johand@osiris:~/tmp$ apt-file show pvm-dev | grep pvm3.h pvm-dev: /usr/include/fpvm3.h pvm-dev: /usr/include/pvm3.h
et puis il manque des include
#include <stdlib.h> #include <string.h> #include <unistd.h>
non exhaustif....
Johan
Gates gave ^H sold you the windows.
GNU gave us the whole house.(Alexandrin)
oui il sont installé le probleme c'eté au niveau de la variable PVM_ROOT
mais maintenant le probleme au PVL_ARCH voici l'erreur quand j'execute
aimk hello
grep: usr/lib/pvm3/conf/usr/lib/pvm3/lib/pvmgetarch.def: Aucun fichier ou dossier de ce type
making in . for usr/lib/pvm3/lib/pvmgetarch
exec: 105: PVM_ARCH=usr/lib/pvm3/lib/pvmgetarch: not found
pourtant le fichier pvmgetarch existe mais il est presque vide
voici son contenu
#! /bin/sh
echo LINUX
Merci bcp
mais maintenant le probleme au PVL_ARCH voici l'erreur quand j'execute
aimk hello
grep: usr/lib/pvm3/conf/usr/lib/pvm3/lib/pvmgetarch.def: Aucun fichier ou dossier de ce type
making in . for usr/lib/pvm3/lib/pvmgetarch
exec: 105: PVM_ARCH=usr/lib/pvm3/lib/pvmgetarch: not found
pourtant le fichier pvmgetarch existe mais il est presque vide
voici son contenu
#! /bin/sh
echo LINUX
Merci bcp
j'ai telechargé un pquet pvm et j'ai changé PVM_ROOT=..../pvm3
mais j'ai d'autre erreur quand j'execute aimk hello
cc hello.c -o hello
/tmp/ccwXwbMU.o: In function 'main':
hello.c:(.text+0x16): undefined reference to 'pvm_parent'
hello.c:(.text+0x67): undefined reference to 'pvm_initsend'
hello.c:(.text+0x73): undefined reference to 'pvm_pkstr'
hello.c:(.text+0x87): undefined reference to 'pvm_send'
hello.c:(.text+0x8c): undefined reference to 'pvm_exit'
collect2: ld returned 1 exit status
make: *** [hello] Erreur 1
merci
mais j'ai d'autre erreur quand j'execute aimk hello
cc hello.c -o hello
/tmp/ccwXwbMU.o: In function 'main':
hello.c:(.text+0x16): undefined reference to 'pvm_parent'
hello.c:(.text+0x67): undefined reference to 'pvm_initsend'
hello.c:(.text+0x73): undefined reference to 'pvm_pkstr'
hello.c:(.text+0x87): undefined reference to 'pvm_send'
hello.c:(.text+0x8c): undefined reference to 'pvm_exit'
collect2: ld returned 1 exit status
make: *** [hello] Erreur 1
merci