Hello,<br><br>I tried doing the same but it is not working. Let me tell you about the program: It has some problems with external references i think::<br>FIRST FUNCTION: MAIN FUNCTION WITH GLOBAL VARIABLE<br>-------------------------------------------------------------------------------------------------<br>
#include <stdio.h><br>int globalvariable[10];<br>int externalfunc(int* , int);<br><br>int main()<br>{<br>     int a[10];<br>     int temp = 10;<br>     externalfunc(a , temp);<br>     for(i =0; i<10;i++)<br>         printf("\n %d", globalvariable[i]);<br>
       <br>     return 0;<br>}<br>------------------------<br>THE SECOND FUNCTION IN FUNCTION.C FILE<br><br>extern int globalvariable[10];<br>int externalfunc(int a[], int temp)<br>{<br>   int i;<br>      for (i=0; i<10; i++)<br>
       {<br>             globalvariable[i]= a[i] + temp;<br>       }<br>    return 0;<br>}<br><br><div class="gmail_quote">On Thu, Feb 18, 2010 at 4:42 PM, Ahmed Charles <span dir="ltr"><<a href="mailto:ahmedcharles@gmail.com">ahmedcharles@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br><br><div class="gmail_quote"><div class="im">On Thu, Feb 18, 2010 at 12:16 PM, kalyan ponnala <span dir="ltr"><<a href="mailto:ponnala.kalyan@gmail.com" target="_blank">ponnala.kalyan@gmail.com</a>></span> wrote:<br>
</div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I am trying to create an small project using visual studio. <br>I would like to know how to create a project with two '.c' source files. The first .c file should have the main() program and a function declaration and function call in it.<br>


The second .c file should contain the function definition. <br>I tried doing that using visual studio. It can compile and understand that the function definition is in a separate .c file (but in the same project folder). But when I tried to compile the same program with<br>


 clang -c main.c -emit-llvm -o main.bc<br clear="all">lli main.bc<br><br>It gave me this error:<br>LLVM ERROR: program used external function 'functioncall' which could not be resolved!<br><br>could you tell me how to debug these kind of projects which have the function definitions in a separate .c file ??<br>


<br></blockquote></div></div><div><br>(Should've replied to everyone.)<div class="im"><br><br>The IDE hides a lot from you. What it's really doing is calling cl.exe with both files (either at once or separately).<br>
<br>Try:<br><br>clang -c other.c -emit-llvm -o other.bc<br>
lli main.bc other.bc <br></div></div></div><br>
</blockquote></div><br><br clear="all"><br>-- <br>Kalyan Ponnala<br>phone: 8163772059<br>