<br><br><div class="gmail_quote">2009/5/16 Hendrik Sattler <span dir="ltr"><<a href="mailto:post@hendrik-sattler.de">post@hendrik-sattler.de</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Am Freitag 15 Mai 2009 17:05:58 schrieb ankit jain:<br>
[...]<br>
<br>
The following works with VS2008 without any problem as expected:<br>
CMakeLists.txt:<br>
--------------------------------------------------------------<br>
project(var C)<br>
add_executable(var sub/main.c var.c var.h)<br>
--------------------------------------------------------------<br>
</blockquote><div>Just try this:<br>add_library(var sub/main.c var.c) <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
var.c:<br>
--------------------------------------------------------------<br>
// #include "var.h"(dont include this line since no var.h is there)<br>
</blockquote><div> #include<stdio.h> <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">char* var1 = "Hallo";<br>
--------------------------------------------------------------<br>
<br>
//var.h:<br>
--------------------------------------------------------------<br>
//extern char *var1;<br>
--------------------------------------------------------------<br>
<br>
sub/main.c<br>
--------------------------------------------------------------<br>// #include "../var.h"<br>
#include <stdio.h></blockquote><div>extern char *var1; <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
int main (int argc, char **argv)<br>
{<br>
printf(var1);<br>
return 0;<br>
}<br>
--------------------------------------------------------------<br>
<br>
So the problem is _definitely_ with your code.<br>
<font color="#888888"></font></blockquote><div><br>I made the changes above can u run this code for me and let me know whether it is working or not.<br>i commented the line which are not there in my code. Also here var.h is not exits since code of var.h is directly there in main.c..<br>
</div><div><br>Ankit <br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><font color="#888888"><br>
HS<br>
<br>
</font></blockquote></div><br>