diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0f1f3ffc62ce1c7415bbdacf5abd4b2483f7fdff..3cf7db93d689e98f5721dd23d957dd591eeadb09 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -777,11 +777,15 @@ if(MSVC)
   add_definitions(-D_USE_MATH_DEFINES -DNOMINMAX 
                   -D_CRT_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_DEPRECATE)
   set(GMSH_SRC ${GMSH_SRC};Fltk/Win32Icon.rc)
-  list(APPEND EXTERNAL_LIBRARIES "ws2_32")
+  list(APPEND EXTERNAL_LIBRARIES "ws2_32.lib")
 endif(MSVC)
 
 if(WIN32 AND NOT HAVE_FLTK)
-  list(APPEND EXTERNAL_LIBRARIES "ws2_32 wsock32")
+  if(MSVC)
+	list(APPEND EXTERNAL_LIBRARIES "wsock32.lib")
+  ELSE(MSVC)
+	list(APPEND EXTERNAL_LIBRARIES "ws2_32.lib wsock32.lib")
+  ENDIF(MSVC)
 endif(WIN32 AND NOT HAVE_FLTK)
 
 list(SORT CONFIG_OPTIONS)
diff --git a/Geo/GModel.cpp b/Geo/GModel.cpp
index 1e1148797b82f7e21250f2b090878a45ef2b1e54..2e0a1c3a5ef7be483a5a31544d43d0d80ae7f92d 100644
--- a/Geo/GModel.cpp
+++ b/Geo/GModel.cpp
@@ -267,7 +267,7 @@ std::vector<GEntity*> GModel::getEdgesByStringTag(const std::string tag)
  std::map<int, std::vector<GEntity*> > physicalGroups[4];
  this->getPhysicalGroups(physicalGroups);
  allEdges = physicalGroups[1][this->getPhysicalNumber(1,tag)];
- 
+ return allEdges; 
 }
 GEdge *GModel::getFirstEdgeByStringTag(const std::string tag) 
 {
diff --git a/Mesh/meshGFaceOptimize.cpp b/Mesh/meshGFaceOptimize.cpp
index 404a1aad05376813d460dec3a9ae5469404e0d96..20794238d7464f2a3f68375628371b01a661ce6b 100644
--- a/Mesh/meshGFaceOptimize.cpp
+++ b/Mesh/meshGFaceOptimize.cpp
@@ -1188,6 +1188,7 @@ int postProcessExtraEdges (GFace *gf, std::vector<std::pair<MElement*,MElement*>
   } 
   gf->triangles = remained;
   */
+	return 0;
 }
 
 bool edgeSwap(std::set<swapquad> &configs, MTri3 *t1, GFace *gf, int iLocalEdge,
diff --git a/Mesh/meshPartition.cpp b/Mesh/meshPartition.cpp
index 95ee43016aa382b807ed8193a0de35a2be81e58b..905b80664d4e54ed82486282f831c755a13e9777 100644
--- a/Mesh/meshPartition.cpp
+++ b/Mesh/meshPartition.cpp
@@ -437,7 +437,8 @@ int PartitionGraph(Graph &graph, meshPartitionOptions &options)
         int numflag = 0;
         // if metisOptions[0]=0 then default options
         int metisOptions[5];
-        float ubvec[options.ncon];
+		std::vector<float> ubvec(options.ncon);
+//        float ubvec[options.ncon];
         int edgeCut;
         const int iSec = 0;
         switch(options.algorithm) {
@@ -522,7 +523,7 @@ int PartitionGraph(Graph &graph, meshPartitionOptions &options)
             METIS_mCPartGraphKway
               (&n,&options.ncon,&graph.xadj[graph.section[iSec]],
                &graph.adjncy[graph.section[iSec]], &graph.vwgts[graph.section[iSec]], NULL, &wgtflag, &numflag,
-               &options.num_partitions,ubvec, metisOptions, &edgeCut,
+               &options.num_partitions,&ubvec[0], metisOptions, &edgeCut,
                &graph.partition[graph.section[iSec]]);
           }
           break;
diff --git a/Plugin/GSHHS.cpp b/Plugin/GSHHS.cpp
index 68a3629f814171debfd19822165eb862e94712dd..6dcdf3a049bb6fb9384f94bb9547d31baaebbb53 100644
--- a/Plugin/GSHHS.cpp
+++ b/Plugin/GSHHS.cpp
@@ -16,7 +16,9 @@ class Field {
   virtual double operator() (double x, double y, double z){ return 0.; }
 };
 #endif
-
+#if defined(_MSC_VER)
+inline double round(double x) { return floor(x + 0.5); }
+#endif
 class GMSH_GSHHSPlugin : public GMSH_PostPlugin
 {
 public:
@@ -559,7 +561,7 @@ public:
       }while(p!=i1);
       i0->to_stereo(x[2],y[2],reverse_stereo);
       alpha+=get_angle(x[0],y[0],x[1],y[1],x[2],y[2]);
-      return (int)round(alpha/(M_PI*2));
+	  return (int)round(alpha/(M_PI*2));
     }
     int length(iterator i0,iterator i1)
     {