[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TRNSYS-users] new component in C++



Hi Wouter,

It is possible that the problem is caused by the compiler setting for the way in which external procedures are called. I have very limited experience with
devc++, but you should be able to set the calling convention to C
reference (cdecl). In addition, you need to link to the Trndll.lib which contains the calling definitions for all the routines.

If you have access to Visual Studio, try using the solution file that is created by the Studio when you export the proforma as C++. This solution file has all the correct settings and call to Trndll.lib.

I hope this helps.
Regards,

Diego



Quoting Wouter Lumen <wouter.lumen@ugent.be>:

David,

Thank you for your answer.


The trnsysfunctions that the compiler doesn't find are in the headerfile.
Even the storage functions that weren't in it originally were added.

I my earlier mail i only gave the types of errors i was getting.
Actually, everytime a trnsysfunction is called upon in the cpp-file I get an
error:
Here's all of them:

1>.\ttestcomp.cpp(155) : error C3861: 'getStorageVars': identifier not found
1>.\ttestcomp.cpp(157) : error C3861: 'setStorageVars': identifier not found
1>.\ttestcomp.cpp(180) : error C3861: 'TYPECK': identifier not found
1>.\ttestcomp.cpp(184) : error C3861: 'setStorageSize': identifier not found
1>.\ttestcomp.cpp(193) : error C3861: 'getSimulationStartTime':
identifier not found
1>.\ttestcomp.cpp(194) : error C3861: 'getSimulationTimeStep':
identifier not found
1>.\ttestcomp.cpp(211) : error C3861: 'setStorageVars': identifier not found
1>.\ttestcomp.cpp(227) : error C3861: 'getStorageVars': identifier not found
1>.\ttestcomp.cpp(267) : error C3861: 'setStorageVars': identifier not found

These are all the same type of errors. (this time the file was
compiled with MSVisualC++2005.)

I have tried 3 different compilers and all of them give these errors.

Could this have to do something with compiler settings?


Thank you.

Kind Regards,
Wouter Lumen


Citeren Technical Support <TechSupport@tess-inc.com>:

Wouter,

Create new component in the simulation studio.
Already here there is something that i'm uncertain about in the proforma:
Under the tab "files": what do i have fill in for "compiling command"?
Do i have to put a path there to my c++ compiler?

no, you don't have to put anything there. That field is there if you want
to be able to execute a compile/link command from within the Studio. If
you are comfortable using your compiler interface, there is no need for
the Studio link.

Then, when i have written my component and i try to compile i get the
following  type of errors:

"[linker error] undefined reference to '_imp_TYPECK'"

"[linker error] undefined reference to
'_imp_TRNSYSFUNCTIONS_mp_GETSIMULATIONSTARTIME'"

"[linker error] undefined reference to 'WinMain@16'"

Please check the trnsys.h file (you can open it with a text editor) and
make sure that both the function GetSimulationStartTime and the subroutine
TYPECK are exported. With some of the early TRNSYS 16 releases, the
trnsys.h file was incomplete and did not have all of the subroutines and
functions exported.

Kind regards,
 David


Technical Support Team
Thermal Energy System Specialists, LLC
2916 Marketplace Dr, Suite 104
Madison, WI 53719
techsupport@tess-inc.com



_______________________________________________
TRNSYS-users mailing list
TRNSYS-users@engr.wisc.edu
https://www.cae.wisc.edu/mailman/listinfo/trnsys-users