Thread: Compiling Error in Visual Studio 2005

  1. #1
    Registered User
    Join Date
    Feb 2009
    Posts
    1

    Compiling Error in Visual Studio 2005

    Hi all,

    I'm a newbie to using VS 2005 and recently I'm trying to compile some codes but I'm encountering some difficulties. Will appreciate it if you guys could help me out here. Thanks in advance.

    Basically the error I'm encountering is as below,

    error C2664: 'PhyCalcEtieln' : cannot convert parameter 4 from 'double [14][3]' to 'double *'

    For the rest of the codes, it's inside the attached file.

    Thanks again!

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    You are passing a double** where only a double* is expected. You need to change either the function or the parameter to something that matches.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Apr 2007
    Posts
    141
    Quote Originally Posted by nvoigt View Post
    You are passing a double** where only a double* is expected. You need to change either the function or the parameter to something that matches.
    Which is one reason why I never use multi-dimensional arrays in C or C++. I always use flat arrays and indexing functions or macros to get the same effect. The other reason has to do with the formats commonly used in numeric software such as BLAS or FFT libraries. Flat arrays are the norm.


    My recommendation is to change your array format to be a flat array of the type,
    Code:
    double x1e[ND * 3]={
    		0.0500,  0.0,     0.950  ,0.04293, 0.04503, 0.91204,
    		0.06206, 0.08990, 0.84803,0.07537, 0.12649, 0.79814,
                0.09640, 0.17191, 0.73169,0.12475, 0.20078, 0.67447,
    		0.17126, 0.25278, 0.57596,0.20346, 0.27928, 0.51726,
    		0.25974, 0.32027, 0.41999,0.33525, 0.35067, 0.31408,
    		0.40969, 0.35607, 0.23424,0.48556, 0.34552, 0.16893,
    		0.54515, 0.32321, 0.13163,0.61497, 0.29044, 0.09459  };
    Then create an indexing macro of the sort,
    Code:
    #define ixptr(val, i, j)  ((val)+(j) + (i)*3)
    Code is not checked for correctness.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by nvoigt View Post
    You are passing a double** where only a double* is expected. You need to change either the function or the parameter to something that matches.
    Actually, a 2D array is not a double ** either.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by SevenThunders View Post
    Which is one reason why I never use multi-dimensional arrays in C or C++. I always use flat arrays and indexing functions or macros to get the same effect. The other reason has to do with the formats commonly used in numeric software such as BLAS or FFT libraries. Flat arrays are the norm.


    My recommendation is to change your array format to be a flat array of the type,
    Code:
    double x1e[ND * 3]={
    		0.0500,  0.0,     0.950  ,0.04293, 0.04503, 0.91204,
    		0.06206, 0.08990, 0.84803,0.07537, 0.12649, 0.79814,
                0.09640, 0.17191, 0.73169,0.12475, 0.20078, 0.67447,
    		0.17126, 0.25278, 0.57596,0.20346, 0.27928, 0.51726,
    		0.25974, 0.32027, 0.41999,0.33525, 0.35067, 0.31408,
    		0.40969, 0.35607, 0.23424,0.48556, 0.34552, 0.16893,
    		0.54515, 0.32321, 0.13163,0.61497, 0.29044, 0.09459  };
    Then create an indexing macro of the sort,
    Code:
    #define ixptr(val, i, j)  ((val)+(j) + (i)*3)
    Code is not checked for correctness.
    I would rather use true 2D arrays instead of macro trickery.
    They are not as difficult as you let them out to be.
    But without any context, I cannot say where or how you are going wrong. Same goes for OP.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. more then 100errors in header
    By hallo007 in forum Windows Programming
    Replies: 20
    Last Post: 05-13-2007, 08:26 AM
  2. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  3. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM
  4. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 08:57 AM