View Single Post
Old 04-13-2004, 07:32 PM   #1 (permalink)
madcow
Crazy
 
Location: The state of denial
[C and C++] Calling C++ function from c

Hello all,
I have a c program that is doing a few things with a MySQL database and I found a piece of code written in C++ to determine the amount of CPU usage on my machine. I would like to call the function written in C++ in my C program and then write this to the database, compiling goes fine until the linker fails saying:

Linking...
net_sql.obj : error LNK2001: unresolved external symbol _GetCpuUsage
release/netsql.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Any idea why this is happening? Is there some way to do what I am trying to do?

I'm using Microsoft Visual C++ 6. The Cpu usage code is not a lib or dll, just cpp files.
madcow is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76