CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

Errors when Compiling UDF: error C2040/error C2099

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   December 19, 2008, 05:30
Default Errors when Compiling UDF: error C2040/error C2099
  #1
Julian K.
Guest
 
Posts: n/a
Hallo,

I would like to use a very simple UDF, which writes informations of particles into a file. For compiling the UDF, I downloaded 'Visual C++ 2008 Express', go to the 'libudf\ntx86\3d>' directory and type 'nmake'.

Here is my UDF-Code:

------------------------------------------------------------

/*#define USE_FLUENT_IO_API 1*/

#define USE_FLUENT_IO_API 0

#include "udf.h"

FILE *fp;

fp = fopen ("myfile.txt","w");

DEFINE_DPM_OUTPUT(discrete_phase_sample,header,fp, p,t,plane)

{

float x,y,z;

x = P_POS(p)[0];

y = P_POS(p)[1];

z = P_POS(p)[2];

fprintf(fp,"%d %f %f %f\n",p->part_id, x, y, z);

}

------------------------------------------------------------

Quite simple I guess, but anyhow, my computer doesn't like the 'FILE' command. Here is what I get, after I typed 'nmake':

------------------------------------------------------------

Setting environment for using Microsoft Visual Studio 2008 x86 tools.

c:\Users\Casper\Desktop\UDF-test\libudf\ntx86\3d>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.30729.01 Copyright (C) Microsoft Corporation. All rights reserved.

cl /c /Za /DUDF_EXPORTING -Ic:\fluent.inc\fluent6.3.26\ntx86\3d -Ic:\fl uent.inc\fluent6.3.26\src -Ic:\fluent.inc\fluent6.3.26\cortex\src -Ic:\fluent. inc\fluent6.3.26\client\src -Ic:\fluent.inc\fluent6.3.26\tgrid\src -Ic:\fluent .inc\fluent6.3.26\multiport\src ..\..\src\dpm_counter.c Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 15.00.30729.01 for 80x86 Copyright (C) Microsoft Corporation. All rights reserved.

dpm_counter.c

..\..\src\dpm_counter.c(14) : error C2040: 'pFile' : 'int' differs in levels of indirection from 'FILE *'

..\..\src\dpm_counter.c(14) : error C2099: initializer is not a constant NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN \cl.EXE"' : return code '0x2' Stop.

c:\Users\Casper\Desktop\UDF-test\libudf\ntx86\3d>

------------------------------------------------------------

Here are some information about my system:

Windows Vista 32-bit

dual-core 1.6GH 64-bit

Fluent 6.3

Visual C++ 2008 Express Edition

I searched the Forum and the internet for some solution but couldn't find any.

Hope, you can help me,

best wishes,

Julian

  Reply With Quote

Old   December 21, 2008, 01:23
Default Re: Errors when Compiling UDF: error C2040/error C
  #2
sk
Guest
 
Posts: n/a
Hai

try to start fluent from Vc++ command prompt and then compile udf.. Hopefully it will work. almost all the 'nmake' error occurs because of this.

regards sk.
  Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling udf error help venkatesh4386@gmail.com FLUENT 1 November 7, 2008 03:20
UDF error in compiling Shin FLUENT 1 December 15, 2007 21:25
Compiling ERROR hans007 FLUENT 0 December 12, 2007 05:58
Compiling Error in 6.1 Matthew Brannock FLUENT 2 April 3, 2003 23:34
Error while compiling UDF Sridhar FLUENT 0 August 7, 2001 12:02


All times are GMT -4. The time now is 15:06.