CFD Online Logo CFD Online URL
Home > Forums > FLUENT

Errors when Compiling UDF: error C2040/error C2099

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

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

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*/


#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.


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

cl /c /Za /DUDF_EXPORTING -Ic:\\fluent6.3.26\ntx86\3d -Ic:\fl\fluent6.3.26\src -Ic:\\fluent6.3.26\cortex\src -Ic:\fluent. inc\fluent6.3.26\client\src -Ic:\\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.


..\..\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.



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,


  Reply With Quote

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

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


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
compiling udf error help 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 22:34
Error while compiling UDF Sridhar FLUENT 0 August 7, 2001 11:02

All times are GMT -4. The time now is 20:54.