delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/23/21:00:30

From: Geoffroy Rivet-Sabourin <rivets00 AT gel DOT ulaval DOT ca>
Newsgroups: comp.os.msdos.djgpp
Subject: problem to compile with DJGPP
Date: Tue, 23 Dec 1997 20:14:56 -0500
Organization: VTL
Lines: 102
Message-ID: <34A06210.193B@gel.ulaval.ca>
Reply-To: rivets00 AT gel DOT ulaval DOT ca
NNTP-Posting-Host: ppp210.83.mque.videotron.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I try to make little class in C++ to test makefile and compilation with
DJGPP. This little class don't link and I don't what is the reason of
this problem. 

	I put in the message C++ code and errors gernerate by compilation.
			Thank you
			GRS

main.cpp:
#include <iostream.h>

#include "test.h"

int main()
{
  int x,y;

  cout << "entrez une valeur de x: ";
  cin >> x;
  cout << endl;
  
  cout << "entrez une valeur de y: ";
  cin >> y;
  cout << endl;
  
  cout << somme(x,y) << endl;
  
  cout << soust(x,y) << endl;
  return 0;
}

classe test
test.h:
#ifndef test_flag
#define test_flag


class test {

public:
  int somme(int,int);
  int soust(int,int);
  test();

};
#endif test_flag

test.cpp
#include <iostream.h>
#include "test.h"
test::somme(int val1,int val2)
{
  return val1+val2;
}

test::soust(int val1,int val2)
{
  return val1-val2;
}

test::test()
{
}

#fichier makefile pour test
 test : main.o test.o
	gxx -o test main.o test.o 
                        
     
     main.o : main.cpp test.h
	gxx -c main.cpp
     
     test.o : test.cpp test.h 
	gxx -c test.cpp


errors:

cd c:/prog/
make -k 
gxx -c test.cpp
gcc.exe: -lgpp: linker input file unused since linking not done
gcc.exe: -lstdcx: linker input file unused since linking not done
gcc.exe: -lm: linker input file unused since linking not done
gxx -o test main.o test.o \
                        
main.o(.text+0xc5):main.cc: undefined reference to `somme'
main.o(.text+0xf7):main.cc: undefined reference to `soust'
make.exe: *** [test] Error 1






-- 



Geoffroy Rivet-Sabourin
Etudiant en Genie informatique
Universite Laval Quebec, Canada

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019