Waitrud Weber’s blog

things and reminders for memories

WindowsAPI: windows-make Additionally does allow...

We recognised mingw does allow the bellow on the "int main()" and doesn't for lnks.

 

 array_counter.h
char* dummy_allocation = nullptr;
char** dummy_ary = nullptr;
int dummy_ary_index = 0;

array_counter.cpp

extern char* dummy_allocation;
extern char** dummy_ary;
extern int dummy_ary_index;

 

which is also mingw futuread.

 

 

 

> c:\aaa\bin\make.exe all
gcc -Wall -O3 -o array_counter.o -c array_counter.cpp
array_counter.cpp: In function 'void place_char(char*, char)':
array_counter.cpp:53:8: warning: unused variable 'result_001' [-Wunused-variable]
  char* result_001;
        ^~~~~~~~~~
array_counter.cpp: In function 'void slide_to_back(char*, int, int)':
array_counter.cpp:73:8: warning: unused variable 'result_001' [-Wunused-variable]
  char *result_001;
        ^~~~~~~~~~
array_counter.cpp: In function 'char* m_replace(char*, char*, char*)':
array_counter.cpp:127:8: warning: unused variable 'to' [-Wunused-variable]
    int to = i + a_t;
        ^~
array_counter.cpp: In function 'char* m_print_buffer(char*)':
array_counter.cpp:193:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
array_counter.cpp: In function 'char* m_concat(char*, char*)':
array_counter.cpp:282:8: warning: unused variable 'c_head' [-Wunused-variable]
  char* c_head;
        ^~~~~~
array_counter.cpp: In function 'char* concat(char*, char*)':
array_counter.cpp:358:7: warning: variable 'ch' set but not used [-Wunused-but-set-variable]
  char ch, ct;
       ^~
array_counter.cpp:358:11: warning: variable 'ct' set but not used [-Wunused-but-set-variable]
  char ch, ct;
           ^~
array_counter.cpp: In function 'char* m_trim(char*)':
array_counter.cpp:492:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  char* result = "\0";
                 ^~~~
array_counter.cpp:493:24: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  char* return_result = "\0";
                        ^~~~
array_counter.cpp:493:8: warning: unused variable 'return_result' [-Wunused-variable]
  char* return_result = "\0";
        ^~~~~~~~~~~~~
array_counter.cpp: In function 'char* back_trim(char*)':
array_counter.cpp:513:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  char* result = "\0";
                 ^~~~
array_counter.cpp:512:6: warning: unused variable 'f_continue' [-Wunused-variable]
  int f_continue = 0;
      ^~~~~~~~~~
array_counter.cpp: In function 'char* front_trim(char*)':
array_counter.cpp:545:17: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
  char* result = "\0";
                 ^~~~
array_counter.cpp:544:6: warning: unused variable 'f_continue' [-Wunused-variable]
  int f_continue = 0;
      ^~~~~~~~~~
array_counter.cpp: In function 'void slide_to_back(char*, int, int)':
array_counter.cpp:61:10: warning: 'back_c' may be used uninitialized in this function [-Wmaybe-uninitialized]
  *p_char = (char) c;
  ~~~~~~~~^~~~~~~~~~
array_counter.cpp:75:7: note: 'back_c' was declared here
  char back_c;
       ^~~~~~
gcc -Wall -O3 -o Print.o -c Print.cpp
Print.cpp: In function 'char* err_msg_001(const char*, ...)':
Print.cpp:262:6: warning: variable 'send_success' set but not used [-Wunused-but-set-variable]
  int send_success = 0;
      ^~~~~~~~~~~~
Print.cpp: In function 'char* err_doit_001(int, int, const char*, va_list)':
Print.cpp:318:26: warning: embedded '\0' in format [-Wformat-contains-nul]
           strerror(error));
                          ^
Print.cpp:318:26: warning: embedded '\0' in format [-Wformat-contains-nul]
Print.cpp:316:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (errnoflag)
     ^~
Print.cpp:321:2: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
  returnable_buf = copyof ( buf );
  ^~~~~~~~~~~~~~
gcc -Wall -O3 -o sender.o -c sender.cpp
gcc -Wall -O3 -o main.o -c main.cpp
gcc array_counter.o Print.o sender.o main.o -Wall -O3 -o analyze_Ca.exe
Print.o:Print.cpp:(.data+0x0): multiple definition of `char_line_end'
array_counter.o:array_counter.cpp:(.data+0x0): first defined here
Print.o:Print.cpp:(.bss+0x0): multiple definition of `dummy_ary_index'
array_counter.o:array_counter.cpp:(.bss+0x0): first defined here
Print.o:Print.cpp:(.bss+0x4): multiple definition of `dummy_ary'
array_counter.o:array_counter.cpp:(.bss+0x4): first defined here
Print.o:Print.cpp:(.bss+0x8): multiple definition of `dummy_allocation'
array_counter.o:array_counter.cpp:(.bss+0x8): first defined here
main.o:main.cpp:(.data+0x0): multiple definition of `char_line_end'
array_counter.o:array_counter.cpp:(.data+0x0): first defined here
main.o:main.cpp:(.bss+0x0): multiple definition of `dummy_ary_index'
array_counter.o:array_counter.cpp:(.bss+0x0): first defined here
main.o:main.cpp:(.bss+0x4): multiple definition of `dummy_ary'
array_counter.o:array_counter.cpp:(.bss+0x4): first defined here
main.o:main.cpp:(.bss+0x8): multiple definition of `dummy_allocation'
array_counter.o:array_counter.cpp:(.bss+0x8): first defined here
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: reopening analyze_Ca.exe: Permission denied

c:/mingw/bin/../lib/gcc/mingw32/6.3.0/../../../../mingw32/bin/ld.exe: final link failed: Permission denied
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:39: analyze_Ca.exe] Error 1