Creating llvm projects using visual studio

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating llvm projects using visual studio

kalyan ponnala
Hi,

I am trying to create an small project using visual studio.
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.
The second .c file should contain the function definition.
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
 clang -c main.c -emit-llvm -o main.bc
lli main.bc

It gave me this error:
LLVM ERROR: program used external function 'functioncall' which could not be resolved!

could you tell me how to debug these kind of projects which have the function definitions in a separate .c file ??

Thanks
--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating llvm projects using visual studio

Ahmed Charles


On Thu, Feb 18, 2010 at 12:16 PM, kalyan ponnala <[hidden email]> wrote:
Hi,

I am trying to create an small project using visual studio.
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.
The second .c file should contain the function definition.
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
 clang -c main.c -emit-llvm -o main.bc
lli main.bc

It gave me this error:
LLVM ERROR: program used external function 'functioncall' which could not be resolved!

could you tell me how to debug these kind of projects which have the function definitions in a separate .c file ??


(Should've replied to everyone.)

The IDE hides a lot from you. What it's really doing is calling cl.exe with both files (either at once or separately).

Try:

clang -c other.c -emit-llvm -o other.bc
lli main.bc other.bc


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Creating llvm projects using visual studio

kalyan ponnala
Hello,

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::
FIRST FUNCTION: MAIN FUNCTION WITH GLOBAL VARIABLE
-------------------------------------------------------------------------------------------------
#include <stdio.h>
int globalvariable[10];
int externalfunc(int* , int);

int main()
{
     int a[10];
     int temp = 10;
     externalfunc(a , temp);
     for(i =0; i<10;i++)
         printf("\n %d", globalvariable[i]);
      
     return 0;
}
------------------------
THE SECOND FUNCTION IN FUNCTION.C FILE

extern int globalvariable[10];
int externalfunc(int a[], int temp)
{
   int i;
      for (i=0; i<10; i++)
       {
             globalvariable[i]= a[i] + temp;
       }
    return 0;
}

On Thu, Feb 18, 2010 at 4:42 PM, Ahmed Charles <[hidden email]> wrote:


On Thu, Feb 18, 2010 at 12:16 PM, kalyan ponnala <[hidden email]> wrote:
Hi,

I am trying to create an small project using visual studio.
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.
The second .c file should contain the function definition.
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
 clang -c main.c -emit-llvm -o main.bc
lli main.bc

It gave me this error:
LLVM ERROR: program used external function 'functioncall' which could not be resolved!

could you tell me how to debug these kind of projects which have the function definitions in a separate .c file ??


(Should've replied to everyone.)


The IDE hides a lot from you. What it's really doing is calling cl.exe with both files (either at once or separately).

Try:

clang -c other.c -emit-llvm -o other.bc
lli main.bc other.bc




--
Kalyan Ponnala
phone: 8163772059

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev