C Error Assignment From Incompatible Pointer Type

Hi,

I just tested the development version v1.12.0 with a simple model of a gas-water heat exchanger, which is working in Version 1.9.7. I simplified the model to the following test-code:

model simple_BasicHX_water_gas package Medium1 = Modelica.Media.IdealGases.SingleGases.N2; package Medium2 = Modelica.Media.Water.ConstantPropertyLiquidWater; end simple_BasicHX_water_gas;

Can't be compiled and give the errors:

C:/OpenModelica1.9.7//share/omc/scripts/Compile.bat TCV.Plant.simple_BasicHX_water_gas gcc mingw64 parallel 4 0
PATH = "C:\OpenModelica1.9.7\MinGW\bin;C:\OpenModelica1.9.7\MinGW\bin\..\libexec\gcc\mingw32\4.4.0\;"
gcc -falign-functions -msse2 -mfpmath=sse -I"C:/OpenModelica1.9.7//include/omc/c" -I. -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME -DOMC_MODEL_PREFIX=TCV_Plant_simple_BasicHX_water_gas -DOMC_NUM_MIXED_SYSTEMS=0 -DOMC_NUM_LINEAR_SYSTEMS=0 -DOMC_NUM_NONLINEAR_SYSTEMS=0 -DOMC_NDELAY_EXPRESSIONS=0 -DOMC_NVAR_STRING=0 -c -o TCV.Plant.simple_BasicHX_water_gas.o TCV.Plant.simple_BasicHX_water_gas.c
In file included from TCV.Plant.simple_BasicHX_water_gas.c:2:
TCV.Plant.simple_BasicHX_water_gas_model.h:70: error: expected declaration specifiers or '...' before 'DAEMODE_DATA'
TCV.Plant.simple_BasicHX_water_gas.c:132: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:141: warning: initialization makes integer from pointer without a cast
TCV.Plant.simple_BasicHX_water_gas.c:148: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:149: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:150: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:151: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:152: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:153: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:154: warning: initialization makes integer from pointer without a cast
TCV.Plant.simple_BasicHX_water_gas.c:155: warning: initialization makes integer from pointer without a cast
TCV.Plant.simple_BasicHX_water_gas.c:158: warning: initialization makes pointer from integer without a cast
TCV.Plant.simple_BasicHX_water_gas.c:159: warning: initialization makes pointer from integer without a cast
TCV.Plant.simple_BasicHX_water_gas.c:166: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:167: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:168: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:169: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:170: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:171: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:172: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:173: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:174: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:175: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:176: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:177: warning: initialization from incompatible pointer type
TCV.Plant.simple_BasicHX_water_gas.c:178: warning: excess elements in struct initializer
TCV.Plant.simple_BasicHX_water_gas.c:178: warning: (near initialization for 'TCV_Plant_simple_BasicHX_water_gas_callback')
TCV.Plant.simple_BasicHX_water_gas.c:184: warning: excess elements in struct initializer
TCV.Plant.simple_BasicHX_water_gas.c:184: warning: (near initialization for 'TCV_Plant_simple_BasicHX_water_gas_callback')
TCV.Plant.simple_BasicHX_water_gas.c:187: warning: excess elements in struct initializer
TCV.Plant.simple_BasicHX_water_gas.c:187: warning: (near initialization for 'TCV_Plant_simple_BasicHX_water_gas_callback')
TCV.Plant.simple_BasicHX_water_gas.c: In function 'TCV_Plant_simple_BasicHX_water_gas_setupDataStruc':
TCV.Plant.simple_BasicHX_water_gas.c:266: error: 'MODEL_DATA' has no member named 'nSensitivityVars'
TCV.Plant.simple_BasicHX_water_gas.c:267: error: 'MODEL_DATA' has no member named 'nSensitivityParamVars'
TCV.Plant.simple_BasicHX_water_gas.c: In function 'main':
TCV.Plant.simple_BasicHX_water_gas.c:295: error: 'compiledInDAEMode' undeclared (first use in this function)
TCV.Plant.simple_BasicHX_water_gas.c:295: error: (Each undeclared identifier is reported only once
TCV.Plant.simple_BasicHX_water_gas.c:295: error: for each function it appears in.)
\MinGW\bin\mingw32-make: * [TCV.Plant.simple_BasicHX_water_gas.o] Error 1
Compilation process failed. Exited with code 2.

This is the mail archive of the mailing list for the GCC project.


Re: Avoiding "assignment from incompatible pointer type" warning

  • From: "Joshua Nye" <josh at boxcarmedia dot com>
  • To: "Steve Dondley" <s at dondley dot com>, <gcc-help at gcc dot gnu dot org>
  • Date: Sun, 13 Oct 2002 12:28:10 -0400
  • Subject: Re: Avoiding "assignment from incompatible pointer type" warning
  • References: <FAECKOGIHAIBBPKBOKGNEEDNDOAA.s@dondley.com>

Hi Steve, What you're looking for is a cast. i.e.: int *p; float g = 3.141592653589793238; p = (int *)&g; --josh ----- Original Message ----- From: "Steve Dondley" <s@dondley.com> To: <gcc-help@gcc.gnu.org> Sent: Sunday, October 13, 2002 12:13 PM Subject: Avoiding "assignment from incompatible pointer type" warning > Hi, > > I've written a simple program that print out each bit of a floating point > variable so I can learn how floating point numbers are represented in > memory. The program contains the following statements: > > int *p; > float g = 2.0625; > p = &g; > > The third statement above generates an "assignment from incompatible pointer > type" warning for obvious reasons. Other than this, the program compiles > fine and works. > > My question is: Is there a way to properly assign a pointer of one type to > a variable of different type so that the warning is suppressed? > > Thanks again. > >

0 thoughts on “C Error Assignment From Incompatible Pointer Type

Leave a Reply

Your email address will not be published. Required fields are marked *