Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » Use function ftofix

This thread is locked; no one can reply to it. rss feed Print
Use function ftofix
ju2ly6
Member #8,451
March 2007

Hello.
I have a Microsoft Visual C++ - Compiler and I try to compile this program:

1#include <allegro.h>
2#include <math.h>
3 
4int main(int argc,char**argv)
5{
6 fixed c[8][8];
7 int a, b;
8 double c;
9 
10 for (a=0; a< 8; a++)
11 {
12 c = (a == 0) ? sqrt(0.125) : 0.5;
13 for (b = 0; b < 8; b++){
14 c[a]<b> = ftofix(c*a*(b+ 0.5)));
15 }
16 }
17} END_OF_MAIN

>>>> There are no errors or warnings, but when i build a .exe file there are 2 errors:
-------------------Configuration: Display - Win32 Release-------------------
Compiling...
idctref.c
Linking...
idctref.obj : error LNK2001: unresolved external symbol __imp__allegro_errno
Release/Display.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Display.exe - 2 error(s), 0 warning(s)
???
I would be very gratefully, if somebody write an answer in detail to my question, because I am a Newbie in programming with C++.

CGamesPlay
Member #2,559
July 2002
avatar

You seem to have forgotten to add "alleg.lib" to your list of libraries.

--
Tomasu: Every time you read this: hugging!

Ryan Patterson - <http://cgamesplay.com/>

ju2ly6
Member #8,451
March 2007

Dear,
Thanks a lot, my project was run. :D

nonnus29
Member #2,606
August 2002
avatar

If you look at the fixed point code in allegro it's a little... disappointing. For multiplication and division, it converts from fixed to float and then performs the operation and then converts back to fixed. What's the point you ask? Indeed....

Go to: