<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.5726" name=GENERATOR><LINK 
href="BLOCKQUOTE{margin-Top: 0px; margin-Bottom: 0px; margin-Left: 2em}" 
rel=stylesheet></HEAD>
<BODY style="FONT-SIZE: 10pt; MARGIN: 10px; FONT-FAMILY: verdana">
<DIV><FONT face=Verdana size=2>hi, all</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>I am trying to compile qgis's example code "hello world" . </DIV>
<DIV>it has some code like these:</DIV>
<DIV>&nbsp;</DIV>
<DIV>
<TABLE 
style="BORDER-RIGHT: medium none; BORDER-TOP: medium none; FONT-SIZE: 10pt; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none; BORDER-COLLAPSE: collapse" 
borderColor=#000000 cellSpacing=0 cellPadding=2 width="50%" border=1>
  <TBODY>
  <TR>
    <TD 
    style="BORDER-RIGHT: #000000 1px solid; BORDER-TOP: #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-BOTTOM: #000000 1px solid" 
    noWrap width="100%"><FONT face=Verdana size=2>
      <DIV>
      <DIV>QString&nbsp;myLayerPath&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"xxx.shp";</DIV>
      <DIV>&nbsp;&nbsp;QString&nbsp;myLayerBaseName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"xxx";</DIV>
      <DIV>&nbsp;&nbsp;QString&nbsp;myProviderName&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;"ogr";</DIV>
      <DIV>&nbsp;&nbsp;//&nbsp;Instantiate&nbsp;Provider&nbsp;Registry</DIV>
      <DIV>&nbsp;&nbsp;QgsProviderRegistry::instance(myPluginsDir);</DIV>
      <DIV>&nbsp;&nbsp;//&nbsp;create&nbsp;a&nbsp;maplayer&nbsp;instance</DIV>
      <DIV>&nbsp;&nbsp;QgsVectorLayer&nbsp;*&nbsp;mypLayer&nbsp;=&nbsp;</DIV>
      <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new&nbsp;QgsVectorLayer(myLayerPath,&nbsp;myLayerBaseName);</DIV>
      <DIV>&nbsp;&nbsp;QgsSingleSymbolRenderer&nbsp;*mypRenderer&nbsp;=&nbsp;new&nbsp;QgsSingleSymbolRenderer(mypLayer-&gt;geometryType());</DIV>
      <DIV>&nbsp;&nbsp;QList&nbsp;&lt;QgsMapCanvasLayer&gt;&nbsp;myLayerSet;</DIV>
      <DIV>&nbsp;&nbsp;mypLayer-&gt;setRenderer(mypRenderer);</DIV>
      <DIV>&nbsp;&nbsp;if&nbsp;(mypLayer-&gt;isValid())</DIV>
      <DIV>&nbsp;&nbsp;{</DIV>
      <DIV>&nbsp;&nbsp;&nbsp;&nbsp;qDebug("Layer&nbsp;is&nbsp;valid");</DIV>
      <DIV>&nbsp;&nbsp;}</DIV>
      <DIV>&nbsp;&nbsp;else</DIV>
      <DIV>&nbsp;&nbsp;{</DIV>
      <DIV>&nbsp;&nbsp;&nbsp;&nbsp;qDebug("Layer&nbsp;is&nbsp;NOT&nbsp;valid");</DIV>
      <DIV>&nbsp;&nbsp;}</DIV></DIV></FONT></TD></TR></TBODY></TABLE></DIV>
<DIV>&nbsp;</DIV>
<DIV>When i run it. it always goes to "Layer&nbsp;is&nbsp;NOT&nbsp;valid" . But 
my shp file exists in the same directory.</DIV>
<DIV>&nbsp;</DIV>
<DIV>I&nbsp;assign myLayerPath&nbsp;&nbsp;with full path like 
"c:\\qgisexample\\xxx.shp"&nbsp; , and the result goes the same.</DIV>
<DIV>&nbsp;</DIV>
<DIV>What would the problem be ?&nbsp; Any help will be appreciated , thank 
you.</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV align=left><FONT face=Verdana color=#c0c0c0 size=2>2009-04-22 
</FONT></DIV><FONT face=Verdana size=2>
<HR style="WIDTH: 122px; HEIGHT: 2px" align=left SIZE=2>

<DIV><FONT face=Verdana color=#c0c0c0 size=2><SPAN>hermangz</SPAN> 
</FONT></DIV></FONT></BODY></HTML>