ywk_printf.h:
Код: Выделить всё
#define YWK_PRINTF_H
class ywk_printf {
public:
ywk_printf ();
~ywk_printf ();
protected:
const int _len (const char theBlock []);
void _rn (void);
void _print (const char & theLiteral);
void _print_ln (const char & theLiteral);
void _print (const char theBlock []);
void _print_ln (const char theBlock []);
void _printw (const char theBlock []);
void _printd (const int & theValue);
void _printd_ln (const int & theValue);
void _showc (const char theName [], const char & theLiteral);
void _shows (const char theName [], const char theBlock []);
void _showsw (const char theName [], const char theBlock []);
void _showd (const char theName [], const int & theValue);
void _debug (const char thePath [], const int & theLine);
void _debug (const char thePath [], const int & theLine, const char theData []);
private:
void _self (void);
public:
int app (int argc, char * argv []);
};
#endif
Код: Выделить всё
#include <cstdio>
#include <cstring>
#include "ywk_printf.h"
ywk_printf::ywk_printf () {
};
ywk_printf::~ywk_printf () {
};
// Вывести количество символов в массиве.
const int ywk_printf::_len (const char theBlock []) {
return theBlock ? strlen (theBlock) : 0;
}
void ywk_printf::_rn (void) {
printf ("%s", "\r\n");
}
void ywk_printf::_print (const char & theLiteral) {
printf ("%c", theLiteral);
}
void ywk_printf::_print_ln (const char & theLiteral) {
printf ("%c", theLiteral);
_rn ();
}
void ywk_printf::_print (const char theBlock []) {
printf ("%s", theBlock);
}
void ywk_printf::_print_ln (const char theBlock []) {
printf ("%s", theBlock);
_rn ();
}
void ywk_printf::_printw (const char theBlock []) {
for (
int x = 0;
x < _len (theBlock);
x++
) {
printf ("'%c' ", theBlock [x]);
};
_rn ();
}
void ywk_printf::_printd (const int & theValue) {
printf ("%d", theValue);
}
void ywk_printf::_printd_ln (const int & theValue) {
_printd (theValue);
_rn ();
}
void ywk_printf::_showc (const char theName [], const char & theLiteral) {
_print (theName);
_print (" == ");
_print ('\'');
_print (theLiteral);
_print ('\'');
_rn ();
}
void ywk_printf::_shows (const char theName [], const char theBlock []) {
_print (theName);
_print (" == ");
_print ('\"');
_print (theBlock);
_print ('\"');
_rn ();
}
void ywk_printf::_showsw (const char theName [], const char theBlock []) {
_print (theName);
_print (" == ");
_printw (theBlock);
}
void ywk_printf::_showd (const char theName [], const int & theValue) {
_print (theName);
_print (" == ");
_printd_ln (theValue);
}
void ywk_printf::_debug (const char thePath [], const int & theLine) {
_print ("DEBUG : File : ");
_print (thePath);
_print (" ; Line : ");
_printd (theLine);
_print ('.');
_rn ();
}
void ywk_printf::_debug (const char thePath [], const int & theLine, const char theData []) {
_print ("DEBUG : File : ");
_print (thePath);
_print (" ; Line : ");
_printd (theLine);
_print (" : ");
_print (theData);
_print ('.');
_rn ();
}
void ywk_printf::_self (void) {
_debug (__FILE__,__LINE__);
_print_ln ("Azbuka");
_printw ("Azbuka");
_showc ("Literal", 'a');
_shows ("Data", "String");
_showsw ("Data", "String");
_showd ("Value", 17);
_debug (__FILE__,__LINE__,"DEBUG");
}
int ywk_printf::app (int argc, char * argv []) {
if (argc > 2) {
for (int x = 1; x < argc; x++ ) {
_print_ln (argv [x]);
};
} else {
_self ();
};
return 0;
}
Код: Выделить всё
#include "ywk_printf.h"
int main ( int argc, char * argv [] ) {
ywk_printf c0;
return c0.app (argc, argv);
}
Код: Выделить всё
g++ -o LMain.o -c Main.cpp -std=c++0x
g++ -fPIC -c ywk_printf.cpp -I. -o Lywk_printf.o -std=c++0x
g++ -shared Lywk_printf.o -o libywk_printf.so.0.0.0.ALPHA -Wl,-soname,libywk_printf.so.0.0.0.ALPHA
g++ -L. -lywk_printf.so.0.0.0.ALPHA LMain.o -o Lywk_print.bin
/usr/bin/ld: cannot find -lywk_printf.so.0.0.0.ALPHA
collect2: выполнение ld завершилось с кодом возврата 1
Что я делаю не так?