title: Compiling error in with make with cygwin
body: <p>I am compiling an open source code after installing petsc library on cygwin. I tried to make the file but got the following error:</p>
  
  <p>$ make TopOpt</p>
  
  <pre><code>/usr/bin/mpicxx -o TopOpt.o -c -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fvisibility=hidden -g      -I/home/lingdeer/petsc-3.7.4/include -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/include -I/usr/include   -I./  -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/lib/ -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/include/ `pwd`/TopOpt.cc
  /usr/bin/mpicc   TopOpt.o   -o TopOpt
  TopOpt.o: In function `TopOpt::TopOpt()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x20): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x56): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x68): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: more undefined references to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()' follow
  TopOpt.o: In function `TopOpt::TopOpt()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x7a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x13c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x153): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x16a): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x181): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14:(.text+0x198): additional relocation overflows omitted from the output
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:14: more undefined references to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()' follow
  TopOpt.o: In function `TopOpt::~TopOpt()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:37: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:38: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:39: undefined reference to `VecDestroyVecs'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:41: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:42: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:43: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:44: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:46: undefined reference to `DMDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:47: undefined reference to `DMDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:53: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:54: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:55: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:56: undefined reference to `VecDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:33: more undefined references to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()' follow
  TopOpt.o: In function `TopOpt::SetUp()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:92: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:94: undefined reference to `PetscError'
  TopOpt.o: In function `TopOpt::SetUpMESH()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:108: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:109: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:110: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:111: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:112: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:113: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:114: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:115: undefined reference to `PetscOptionsGetReal'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:116: more undefined references to `PetscOptionsGetReal' follow
  TopOpt.o: In function `TopOpt::SetUpMESH()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:118: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:122: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:123: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:124: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:125: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:126: undefined reference to `PetscPrintf'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:127: more undefined references to `PetscPrintf' follow
  TopOpt.o: In function `TopOpt::SetUpMESH()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:183: undefined reference to `DMDACreate3d'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:184: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:187: undefined reference to `DMDASetUniformCoordinates'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:188: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:192: undefined reference to `DMDASetElementType'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:193: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:199: undefined reference to `DMDAGetInfo'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:200: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:209: undefined reference to `DMDAGetOwnershipRanges'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:210: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:229: undefined reference to `DMDACreate3d'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:230: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:233: undefined reference to `DMDASetUniformCoordinates'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:234: undefined reference to `PetscError'
  TopOpt.o: In function `TopOpt::SetUpOPT()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:250: undefined reference to `DMCreateGlobalVector'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:250: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:252: undefined reference to `VecGetSize'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:257: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:258: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:259: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:260: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:261: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:262: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:263: undefined reference to `PetscOptionsGetInt'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:264: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:265: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:266: undefined reference to `PetscOptionsGetReal'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:268: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:269: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:270: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:271: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:272: undefined reference to `PetscPrintf'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:273: more undefined references to `PetscPrintf' follow
  TopOpt.o: In function `TopOpt::SetUpOPT()':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:286: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:286: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:287: undefined reference to `VecSet'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:288: undefined reference to `VecSet'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:291: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:291: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:292: undefined reference to `VecDuplicateVecs'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:292: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:295: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:296: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:297: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:298: undefined reference to `VecSet'
  TopOpt.o: In function `TopOpt::AllocateMMAwithRestart(int*, MMA**)':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:325: undefined reference to `PetscOptionsGetBool'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:326: undefined reference to `PetscOptionsGetBool'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:329: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:329: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:330: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:330: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:331: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:331: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:332: undefined reference to `VecDuplicate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:332: undefined reference to `PetscError'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::allocator&lt;char&gt;::allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:337: undefined reference to `PetscOptionsGetString'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:339: undefined reference to `std::string::operator=(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:340: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:342: undefined reference to `std::string::operator=(std::string const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:343: undefined reference to `std::string::operator=(std::string const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:344: undefined reference to `std::string::operator=(std::string const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:345: undefined reference to `std::string::operator=(std::string const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:347: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:348: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:349: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:350: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:353: undefined reference to `std::allocator&lt;char&gt;::allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:353: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:353: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:354: undefined reference to `std::allocator&lt;char&gt;::allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:354: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::basic_string(char const*, std::allocator&lt;char&gt; const&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:354: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:356: undefined reference to `PetscOptionsGetString'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:358: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:360: undefined reference to `PetscOptionsGetString'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:362: undefined reference to `std::string::append(char const*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:366: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:367: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:368: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:368: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:369: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:369: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:370: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:370: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:374: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:374: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:376: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:376: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:381: undefined reference to `VecGetSize'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:386: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:386: undefined reference to `PetscViewerBinaryOpen'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:388: undefined reference to `VecLoad'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:389: undefined reference to `VecLoad'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:390: undefined reference to `VecLoad'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:391: undefined reference to `VecLoad'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:392: undefined reference to `VecLoad'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:393: more undefined references to `VecLoad' follow
  TopOpt.o: In function `TopOpt::AllocateMMAwithRestart(int*, MMA**)':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:394: undefined reference to `PetscViewerDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:397: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:397: undefined reference to `std::basic_fstream&lt;char, std::char_traits&lt;char&gt; &gt;::basic_fstream(char const*, std::_Ios_Openmode)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:398: undefined reference to `std::istream::operator&gt;&gt;(int&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:399: undefined reference to `std::istream::operator&gt;&gt;(double&amp;)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:404: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:404: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:405: undefined reference to `MMA::MMA(int, int, _p_Vec*, double*, double*, double*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:408: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:408: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:409: undefined reference to `MMA::MMA(int, int, int, _p_Vec*, _p_Vec*, _p_Vec*, _p_Vec*, double*, double*, double*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:412: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:412: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:412: undefined reference to `PetscPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:397: undefined reference to `std::basic_fstream&lt;char, std::char_traits&lt;char&gt; &gt;::~basic_fstream()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:415: undefined reference to `MMA::MMA(int, int, _p_Vec*, double*, double*, double*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:354: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:353: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::allocator&lt;char&gt;::~allocator()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:397: undefined reference to `std::basic_fstream&lt;char, std::char_traits&lt;char&gt; &gt;::~basic_fstream()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:354: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:353: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:336: undefined reference to `std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;::~basic_string()'
  TopOpt.o: In function `TopOpt::WriteRestartFiles(int*, MMA*)':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:431: undefined reference to `MMA::Restart(_p_Vec*, _p_Vec*, _p_Vec*, _p_Vec*)'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:443: undefined reference to `PetscViewerCreate'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:444: undefined reference to `PetscViewerSetType'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:445: undefined reference to `PetscViewerFileSetMode'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:449: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:449: undefined reference to `PetscViewerBinaryOpen'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:450: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:450: undefined reference to `PetscViewerFileSetName'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:453: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:453: undefined reference to `PetscViewerBinaryOpen'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:454: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:454: undefined reference to `PetscViewerFileSetName'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:458: undefined reference to `PetscViewerASCIIPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:459: undefined reference to `PetscViewerASCIIPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:460: undefined reference to `PetscViewerASCIIPrintf'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:463: undefined reference to `VecView'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:464: undefined reference to `VecView'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:465: undefined reference to `VecView'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:466: undefined reference to `VecView'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:467: undefined reference to `VecView'
  TopOpt.o:/home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:468: more undefined references to `VecView' follow
  TopOpt.o: In function `TopOpt::WriteRestartFiles(int*, MMA*)':
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:471: undefined reference to `PetscViewerDestroy'
  /home/lingdeer/TopOpt_in_PETSc/TopOpt.cc:472: undefined reference to `PetscViewerDestroy'
  TopOpt.o: In function `__static_initialization_and_destruction_0':
  /usr/lib/gcc/x86_64-pc-cygwin/5.4.0/include/c++/iostream:74: undefined reference to `std::ios_base::Init::Init()'
  TopOpt.o:TopOpt.cc:(.data+0x0): undefined reference to `__gxx_personality_seh0'
  TopOpt.o: In function `TopOpt::fexists(std::string const&amp;)':
  /home/lingdeer/TopOpt_in_PETSc/./TopOpt.h:102: undefined reference to `std::string::c_str() const'
  /home/lingdeer/TopOpt_in_PETSc/./TopOpt.h:102: undefined reference to `std::basic_ifstream&lt;char, std::char_traits&lt;char&gt; &gt;::basic_ifstream(char const*, std::_Ios_Openmode)'
  /home/lingdeer/TopOpt_in_PETSc/./TopOpt.h:103: undefined reference to `std::basic_ios&lt;char, std::char_traits&lt;char&gt; &gt;::operator void*() const'
  /home/lingdeer/TopOpt_in_PETSc/./TopOpt.h:102: undefined reference to `std::basic_ifstream&lt;char, std::char_traits&lt;char&gt; &gt;::~basic_ifstream()'
  /home/lingdeer/TopOpt_in_PETSc/./TopOpt.h:102: undefined reference to `std::basic_ifstream&lt;char, std::char_traits&lt;char&gt; &gt;::~basic_ifstream()'
  TopOpt.o:TopOpt.cc:(.xdata$_ZN6TopOpt7fexistsERKSs+0x10): undefined reference to `__gxx_personality_seh0'
  TopOpt.o:TopOpt.cc:(.xdata+0xc): undefined reference to `__gxx_personality_seh0'
  TopOpt.o:TopOpt.cc:(.xdata+0x48): undefined reference to `__gxx_personality_seh0'
  TopOpt.o:TopOpt.cc:(.xdata+0xcc): undefined reference to `__gxx_personality_seh0'
  TopOpt.o:TopOpt.cc:(.rdata$.refptr._ZNSt8ios_base4InitD1Ev[.refptr._ZNSt8ios_base4InitD1Ev]+0x0): undefined reference to `std::ios_base::Init::~Init()'
  TopOpt.o:TopOpt.cc:(.rdata$.refptr.PETSC_COMM_WORLD[.refptr.PETSC_COMM_WORLD]+0x0): undefined reference to `PETSC_COMM_WORLD'
  /usr/lib/libcygwin.a(libcmain.o): In function `main':
  /usr/src/debug/cygwin-2.6.1-1/winsup/cygwin/lib/libcmain.c:37: undefined reference to `WinMain'
  /usr/lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x0): undefined reference to `operator new(unsigned long)'
  /usr/lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x8): undefined reference to `operator new[](unsigned long)'
  /usr/lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x10): undefined reference to `operator delete(void*)'
  /usr/lib/libcygwin.a(_cygwin_crt0_common.o):_cygwin_crt0_common.cc:(.data+0x18): undefined reference to `operator delete[](void*)'
  collect2: error: ld returned 1 exit status
  make: *** [&lt;builtin&gt;: TopOpt] Error 1
  </code></pre>
  
  <p>The make file I used is as follows:</p>
  
  <pre><code>PETSC_DIR=/home/lingdeer/petsc-3.7.4/
  PETSC_ARCH=arch-mswin-c-debug
  CFLAGS = -I./ -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/lib/ -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/include/
  CPPFLAGS= -I./  -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/lib/ -I/home/lingdeer/petsc-3.7.4/arch-mswin-c-debug/include/
  FPPFLAGS=
  LOCDIR= ./
  EXAMPLESC=
  EXAMPLESF=
  MANSEC=
  CLEANFILES=
  NP=
  LDFLAGS= 
  CC = gcc
  CPP = g++
  
  include ${PETSC_DIR}/lib/petsc/conf/variables
  include ${PETSC_DIR}/lib/petsc/conf/rules
  include ${PETSC_DIR}/lib/petsc/conf/test
  topopt: main.o TopOpt.o LinearElasticity.o MMA.o Filter.o PDEFilter.o MPIIO.o chkopts
      rm -rf topopt
      -${CLINKER} -o topopt main.o TopOpt.o LinearElasticity.o MMA.o Filter.o PDEFilter.o MPIIO.o ${PETSC_SYS_LIB}
      ${RM}  main.o TopOpt.o LinearElasticity.o MMA.o Filter.o PDEFilter.o MPIIO.o 
      rm -rf *.o
  
  myclean:
      rm -rf topopt *.o output* binary* log* makevtu.pyc Restart* 
  </code></pre>
  
  <p>I think something is not linked probably. Anyone has seen something like that and knows how to fix?
  Thank you thank you!</p>