SUBDIRS = src src2 |
noinst_PROGRAMS = main1 noinst_LIBRARIES = libclass.a main1_SOURCES = main1.cpp libclass.a libclass_a_SOURCES = myclass.cpp |
#include <iostream> #include "myclass.h" int main(void) { MyClass o(10); cout << o.getx() << endl; return 0; } |
#ifndef __MYCLASS_H__ #define __MYCLASS_H__ class MyClass{ int x; public: MyClass(int i=0); int getx(void); }; #endif /* __MYCLASS_H__ */ |
#include "myclass.h" MyClass::MyClass(int i=0){ x=i; } int MyClass::getx(void) { return x; } |
noinst_PROGRAMS = main2 main2_SOURCES = main2.cpp LDADD = ../1/libclass.a |
#include <iostream> #include "../1/myclass.h" int main(void) { MyClass o(20); cout << o.getx() << endl; return 0; } |