Author Topic: [PCL] Problem compiling: Too few arguments in IsKeyPressed - SOLVED  (Read 3052 times)

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Hi

Eclipse is throwing me this:

Description   Resource   Path   Location   Type
at this point in file   Seed      line 328, external location: /home/cmilovic/PCL/include/pcl/KeyCodes.h   C/C++ Problem
at this point in file   Seed      line 348, external location: /home/cmilovic/PCL/include/pcl/KeyCodes.h   C/C++ Problem
at this point in file   Seed      line 367, external location: /home/cmilovic/PCL/include/pcl/KeyCodes.h   C/C++ Problem
at this point in file   Seed      line 387, external location: /home/cmilovic/PCL/include/pcl/KeyCodes.h   C/C++ Problem
make: *** [SeedInterface.o] Error 1   Seed      line 0   C/C++ Problem
too few arguments to function ‘bool pcl::IsKeyPressed(int, int)’   Seed      line 308, external location: /home/cmilovic/PCL/include/pcl/KeyCodes.h   C/C++ Problem
Invalid project path: Include path not found (/media/USB DISK/Seed-pmx/Debug/$(PCLINCDIR)).   Seed      pathentry   Path Entry Problem


It is very odd, since I compiled the same module (from the same code on the USB drive) in my laptop, but it doesn't work on the university (fresh Fedora 13- KDE install, up to date).
Also, note the final warning. I get the same on every module I compile, anywhere (Ubuntu, Fedora... project on hard drive, etc.).

Ideas?
« Last Edit: 2010 August 10 12:10:57 by Carlos Milovic »
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: [PCL] Problem compiling: Too few arguments in IsKeyPressed
« Reply #1 on: 2010 August 10 08:06:44 »
Toc, toc, Juaaaaaan :D
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Re: [PCL] Problem compiling: Too few arguments in IsKeyPressed
« Reply #2 on: 2010 August 10 12:10:30 »
Never mind... Found the solution by accident. I created a new project file, and then I realized that I had set two variables as undefined in the preferences, when they should be defined (Project properties, for __PCL_LINUX and _REENTRANT)

SOLVED
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Juan Conejero

  • PTeam Member
  • PixInsight Jedi Grand Master
  • ********
  • Posts: 6782
    • View Profile
    • http://pixinsight.com/
Hi Carlos,

Happy to know you've managed to solve this problem.

My advice is to *always* use automatically generated makefiles (UNIX/Linux) and project files (Windows) on all platforms. Use the MakefileGenerator script. If you want to use Eclipse, look carefully at the compilation and linking lines that MakefileGenerator creates and define all the macro definitions, compiler options and include directories in your Eclipse project. Personally, I don't use Eclipse anymore except when I am forced to perform an intensive debugging session. The entire PixInsight platform depends now on MakefileGenerator, from the Core application to all modules, third-party libraries and auxiliary applications.

For example, removing unimportant compiler options (generation of dependency files), this is the compilation line for the 64-bit version of the Sandbox module (the rest of this discussion applies to 32-bit compilations by changing the corresponding compiler options):

g++ -c -pipe -m64 -fPIC -D_REENTRANT -D__PCL_LINUX -I"$(PCLINCDIR)" -O2 -mtune=generic -mfpmath=sse -msse2 -minline-all-stringops -frename-registers -fgcse-after-reload -fpredictive-commoning -ftree-vectorize -ffast-math -fvisibility=hidden -fvisibility-inlines-hidden -fnon-call-exceptions -Wall -Wno-parentheses

From this line you know that the following macro definitions are mandatory:

_REENTRANT
__PCL_LINUX


You need also this include directory:

$(PCLINCDIR)

which requires the PCLINCDIR variable correctly exported in your environment (use your .bash_profile configuration file, more on this below).

The following compiler options are currently being used for all 64-bit modules with GCC:

* -fPIC
-O2
-mtune=generic
-mfpmath=sse
-msse2
-minline-all-stringops
-frename-registers
-fgcse-after-reload
-fpredictive-commoning
-ftree-vectorize
-ffast-math
* -fvisibility=hidden
* -fvisibility-inlines-hidden
* -fnon-call-exceptions
-Wall
-Wno-parentheses


Options marked with an asterisk are mandatory: without them, modules either won't load at all or will be unstable. Note that 32-bit modules don't use -fPIC on Linux (but they do on Mac OS X and FreeBSD).

Note that -ffast-math has some important implications. One of them is that your code is supposed to never allow propagation of non-numeric IEEE entities (NaN or infinities). If you for example try to compute the square root of a negative number, the result will not only be incorrect (NaN), but the behavior of your module will be unpredictable if you allow propagation of the resulting NaN outside your module. Another implication is that the standard classification functions isnan(), isfinite(), etc. will not work at all with -ffast-math. Starting with version 1.6.1, PCL provides replacements for these functions in pcl/Math.h: IsFinite(), IsNaN(), and IsInfinity(). These PCL classification functions will always work correctly irrespective of whether -ffast-math is used or not. You must always use these functions when you need to know for example if your code has produced a NaN, in order to replace it with a suitable value (usually zero).

To help you in setting a correct PI development environment, this is a copy of (the relevant part of) my .bash_profile file on my 64-bit laptop workstation (Fedora 13 x86_64):

Code: [Select]
export PCLDIR=$HOME/PixInsight
export PCLBINDIR32=$PCLDIR/dist/x86/PixInsight/bin
export PCLBINDIR64=$PCLDIR/dist/x86_64/PixInsight/bin
export PCLBINDIR=$PCLBINDIR64
export PCLLIBDIR32=$PCLDIR/lib/x86
export PCLLIBDIR64=$PCLDIR/lib/x86_64
export PCLLIBDIR=$PCLLIBDIR64
export PCLINCDIR=$PCLDIR/include
export PCLSRCDIR=$PCLDIR/src
export QTDIR32=/usr/lib/Qt-4.6.3
export QTDIR64=/usr/lib64/Qt-4.6.3
export QTDIR=$QTDIR64

export PATH=$PATH:$PCLDIR/bin:$QTDIR/bin:$PCLBINDIR

Hope this helps. Let me know if you need more info.
Juan Conejero
PixInsight Development Team
http://pixinsight.com/

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
I think that there is no difference in setting that on .bash_profile and in .bashrc (as I do)... right? Other than that, I defined the environment the same way.

BTW, this may be a very noob question: How do you run the make file generated by the script? ./makefile-x86_64? First I got a permission denied error, and then, when I enabled running permissions, the output is a mess :P
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com

Offline Carlos Milovic

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2173
  • Join the dark side... we have cookies
    • View Profile
    • http://www.astrophoto.cl
Oh, I forgot to ask: Do you just use KWrite to edit the code? (I remember the days I used Emacs...)
Regards,

Carlos Milovic F.
--------------------------------
PixInsight Project Developer
http://www.pixinsight.com