Waitrud Weber’s blog

things and reminders for memories

3d: vLine could be memoried.

vLine could be memoried, and option -mwindows cound not make binary print.

.\main.cpp
  1 :#include <stdio.h>
  2 :#include <stdlib.h>
  3 :
  4 :#include "vPoint.h"
  5 :#include "vLine.h"
  6 :
  7 :
  8 :int main ( int argc, char** argv ) {
  9 : vLine** lines = nullptr;
 10 : vLine* p_lines = nullptr;
 11 :
 12 : printf("lines is going to be memorized.\r\n");
 13 :
 14 : lines = (vLine**) malloc( sizeof(vLine*) * 10 );
 15 :
 16 : for( int i=0; i<10; i++ ) {
 17 :  p_lines = (vLine*) lines[i];
 18 :  p_lines = (vLine*) *(lines + i );
 19 :  lines[i] = new vLine();
 20 :  lines[i]->setLine( new vPoint( (float)i, 0.0f, 0.0f ), new vPoint( i + 1.0f , 0.0f, 0.0f ) );
 21 : }
 22 :
 23 : printf("lines is shown on the following.\r\n");
 24 :
 25 : for( int i=0; i<10; i++ ) {
 26 :  p_lines = (vLine*) lines[i];
 27 :  p_lines = (vLine*) *(lines + i );
 28 :
 29 :  printf( "%f \r\n", p_lines->p1->x );
 30 : }
 31 :
 32 : return 0;
 33 :
 34 :}

PS C:\Users\soresore soreda\source\3d\display-20190516> c:\aaa\bin\make.exe all
mingw32-g++ -Wall -O3 -o vPoint.o -c vPoint.cpp
vPoint.cpp: In member function 'int vPoint::setPoint(float, float, float)':
vPoint.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
mingw32-g++ -Wall -O3 -o vLine.o -c vLine.cpp
mingw32-g++ -Wall -O3 -o main.o -c main.cpp
mingw32-g++ vPoint.o vLine.o main.o -Wall -O3 -I C:\MinGW\include\ -L C:\MinGW\lib -lgdi32 -lws2_32 -lwsock32 -mwindows -o main_001.exe
PS C:\Users\soresore soreda\source\3d\display-20190516> .\main_001.exe
PS C:\Users\soresore soreda\source\3d\display-20190516> c:\aaa\bin\make.exe all
make: Nothing to be done for 'all'.
PS C:\Users\soresore soreda\source\3d\display-20190516> c:\aaa\bin\make.exe clean
del vPoint.o vLine.o main.o
PS C:\Users\soresore soreda\source\3d\display-20190516> c:\aaa\bin\make.exe all
mingw32-g++ -Wall -O3 -o vPoint.o -c vPoint.cpp
vPoint.cpp: In member function 'int vPoint::setPoint(float, float, float)':
vPoint.cpp:18:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
mingw32-g++ -Wall -O3 -o vLine.o -c vLine.cpp
mingw32-g++ -Wall -O3 -o main.o -c main.cpp
mingw32-g++ vPoint.o vLine.o main.o -Wall -O3 -o main_001.exe
PS C:\Users\soresore soreda\source\3d\display-20190516> .\main_001.exe
lines is going to be memorized.
lines is shown on the following.
0.000000
1.000000
2.000000
3.000000
4.000000
5.000000
6.000000
7.000000
8.000000
9.000000
PS C:\Users\soresore soreda\source\3d\display-20190516>