CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Experience: Something about udf_names.c(7): error C2059 when compiling udf (https://www.cfd-online.com/Forums/fluent-udf/85760-experience-something-about-udf_names-c-7-error-c2059-when-compiling-udf.html)

chengdi March 6, 2011 11:53

Experience: Something about udf_names.c(7): error C2059 when compiling udf
 
Phenomena:
udf_names.c(7) : error C2059: syntax error : '}'
udf_names.c(8) : warning C4034: sizeof 0

Solution:
delete any whitespace character adjacent to the string "DEFINE_XXXX".
It should only be look like this:
Code:

DEFINE_XXX(p1,p2,p3)
and recompile.

Comment:
This error costs me 4 hours... :mad:

Actually I'd like to call it this error a bug which stems from the sentence below in the makefile:

Code:

@sed -n "s/^DEFINE_\([_A-Z]*\)( *\([_a-zA-Z0-9]*\).*)/\{\"\2\", (void (*)())\2, UDF_TYPE_\1\},/p" $(SOURCES) >> $@


I do not understand how it works. I think it is used to extract prototype information of the macro and write it to the udf_data[] array in udf_names.c file. However it cannot identify the MACRO with adjacent whitespace.

I hope someone good at makefile could make a patch on this. It must be very easy to professional coders.

Reference:
http://board.fluent.com/ubb/Forum2/HTML/000119.html

namankothari October 6, 2012 06:08

Hey Cheng,

Really your information was very helpful. It worked out !!!

Thanks

isabel January 7, 2014 16:07

Very good advice, thank you very much. I had written DEFINE_PROFILE (T, thread, position) instead DEFINE_PROFILE(T, thread, position)

rsarma July 10, 2014 12:58

Indeed a very good advice. Really appreciate such posts from people in such forums. Thank you.

blackmask July 10, 2014 21:11

[QUOTE=chengdi;298107]

Actually I'd like to call it this error a bug which stems from the sentence below in the makefile:

Code:

@sed -n "s/^DEFINE_\([_A-Z]*\)( *\([_a-zA-Z0-9]*\).*)/\{\"\2\", (void (*)())\2, UDF_TYPE_\1\},/p" $(SOURCES) >> $@


If you want to allow any number of spaces between "DEFINE_XXX" and "(", then the "sed" command should be adapted to
Code:

sed -n "s/^DEFINE_\([_A-Z]*\) *( *\([_a-zA-Z0-9]*\).*)/\{\"\2\", (void (*)())\2, UDF_TYPE_\1\},/p"

marinagr September 26, 2014 14:32

Thank you so much for this information! It worked out fine for me!:)

toghay May 18, 2015 12:35

i love you chengdi
best regards

gaza January 25, 2016 09:09

thanks a lot for this post!

jiangzili September 27, 2018 09:07

Thank you so much for this information!


All times are GMT -4. The time now is 03:35.