Visual Studio 2012 for Dymola cannot compile - visual-studio-2012

I am new using dymola and I have a problem with my project; actually I have to transfert LNG (I am using the medium Methane_Coolprop) from one closed tank to another, it pass trough a valve to decrease the pressure, but when I start the simulation I have errors with my compiler. I will attach some images and also copy the text here, in case anyone knows what can I do please?
Compiling and linking the model (Visual C++).
dsmodel.c
dsmodel.c(330) : warning C4133: 'fonction': types incompatibles - de 'DymStruc0 *' 'ExternalThermodynamicState *'
dsmodel.c(418) : warning C4133: 'fonction': types incompatibles - de 'DymStruc0 *' 'ExternalThermodynamicState *'
dsmodel.c(766) : warning C4133: 'fonction': types incompatibles - de 'DymStruc1 *' 'ExternalSaturationProperties *'
Cration de la bibliothque dymosim.lib et de l'objet dymosim.exp
ExternalMediaLib.lib(CoolPropTools.obj) : error LNK2019: symbole externe non rsolu "private: static void __cdecl std::locale::facet::_Facet_Register(class std::locale::facet *)" (?_Facet_Register#facet#locale#std##CAXPAV123##Z) rfrenc dans la fonction "public: void __thiscall std::locale::facet::_Register(void)" (?_Register#facet#locale#std##QAEXXZ)
ExternalMediaLib.lib(CoolPropTools.obj) : error LNK2019: symbole externe non rsolu "__declspec(dllimport) public: class std::locale::facet * __thiscall std::locale::facet::_Decref(void)" (__imp_?_Decref#facet#locale#std##QAEPAV123#XZ) rfrenc dans la fonction "public: __thiscall std::locale::~locale(void)" (??1locale#std##QAE#XZ)
ExternalMediaLib.lib(CoolPropTools.obj) : error LNK2019: symbole externe non rsolu "__declspec(dllimport) public: void __thiscall std::locale::facet::_Incref(void)" (__imp_?_Incref#facet#locale#std##QAEXXZ) rfrenc dans la fonction "class std::codecvt<char,char,int> const & __cdecl std::use_facet<class std::codecvt<char,char,int> >(class std::locale const &)" (??$use_facet#V?$codecvt#DDH#std###std##YAABV?$codecvt#DDH#0#ABVlocale#0##Z)
dymosim.ex_ : fatal error LNK1120: 3 externes non rsolus

ExternalMedia cannot be used with MSL 4.0.0 at the moment, you will have to use an older version of the MSL (see ReadMe of ExternalMedia here https://github.com/modelica-3rdparty/ExternalMedia/tree/v.3.3.0-dev) . I would suggest to make sure that the example models of the ExternalMedia are working properly before using the media models in your own components.
If the problem persists, a code example would help a lot to answer your question.

Related

Snappy not linking with rust

I was trying to follow the ffi example in the Rustnomicon.
I cloned the snappy repository and built it. I placed the snappy library inside the targets/debug/deps/ directory. Here is the code -
use libc::size_t;
#[link(name = "snappy", kind="static")]
extern "C" {
fn snappy_max_compressed_length(source_length: size_t) -> size_t;
}
fn main() {
let x = unsafe { snappy_max_compressed_length(100) };
println!("max compressed length of a 100 byte buffer: {}", x);
}
When I try to build it, it fails with this error -
LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
snappy.lib(snappy.obj) : error LNK2019: unresolved external symbol __imp__invalid_parameter referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned#U_Default_allocate_traits#std###std##YAPEAX_K#Z)
snappy.lib(snappy-stubs-internal.obj) : error LNK2001: unresolved external symbol __imp__invalid_parameter
snappy.lib(snappy.obj) : error LNK2019: unresolved external symbol __imp__CrtDbgReport referenced in function "void * __cdecl std::_Allocate_manually_vector_aligned<struct std::_Default_allocate_traits>(unsigned __int64)" (??$_Allocate_manually_vector_aligned#U_Default_allocate_traits#std###std##YAPEAX_K#Z)
snappy.lib(snappy-stubs-internal.obj) : error LNK2001: unresolved external symbol __imp__CrtDbgReport
C:\Users\HP\Desktop\rust\c_interop\target\debug\deps\c_interop.exe : fatal error LNK1120: 2 unresolved externals

LNK errors during built project with libcurl added

I've solved for 2 weeks how to build libcurl project. Finally today I managed it, I followed http://curl.haxx.se/libcurl/c/Using-libcurl-with-SSH-support-in-Visual-Studio-2010.pdf but after I wanted to add libcurl to my own project, it throws lot of LNK errors. So here is code my own project, where I want to add libcurl. It's only for downloading file from url:
#include "stdafx.h"
#include "DlData.h"
#include "curl.h"
//#define CURL_STATICLIB
//#pragma comment(lib, "libcurld")
//#pragma comment(lib, "ws2_32")
//#pragma comment(lib, "Wldap32.lib")
size_t write_data(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
size_t written = fwrite(ptr, size, nmemb, stream);
return written;
};
int _tmain(int argc, _TCHAR* argv[])
{
DlData test;
test.PrintMsg("this is test!");
test.WaitForClick();
//Part for download file
CURL *curl;
ofstream fp;
CURLcode res;
char *url = "http://football-data.co.uk/mmz4281/1415/E0.csv";
char outfilename[FILENAME_MAX] = "C:\\Users\\zdenik\\Documents\\GitProjects\\Predictor\\Files\\";
curl = curl_easy_init();
if (curl)
{
fp.open(outfilename);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);
res = curl_easy_perform(curl);
/* always cleanup */
curl_easy_cleanup(curl);
fp.close();
}
cin.get();
return 0;
}
I set my project properties properly (C/C++ - General, Preprocessor, Linker - General, Input) and want to build it as application - exe file. So far I everything went well and I was able to create libcurld.lib which I added to linker in my project properties. After I built it, it throws a lot of LNK errors and it looks like there is no lib added. Here is output:
1>------ Build started: Project: Predictor, Configuration: Debug Win32 ------
1> stdafx.cpp
1> Main.cpp
1> DlData.cpp
1> Generating Code...
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: ___iob_func already defined in LIBCMTD.lib(_file.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _calloc already defined in LIBCMTD.lib(dbgcalloc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _free already defined in LIBCMTD.lib(dbgfree.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _malloc already defined in LIBCMTD.lib(dbgmalloc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _realloc already defined in LIBCMTD.lib(dbgrealloc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memmove already defined in LIBCMTD.lib(memmove.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strchr already defined in LIBCMTD.lib(strchr.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strncmp already defined in LIBCMTD.lib(strncmp.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strrchr already defined in LIBCMTD.lib(strrchr.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fclose already defined in LIBCMTD.lib(fclose.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fopen already defined in LIBCMTD.lib(fopen.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __strtoi64 already defined in LIBCMTD.lib(strtoq.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __errno already defined in LIBCMTD.lib(dosmap.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _tolower already defined in LIBCMTD.lib(tolower.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fseek already defined in LIBCMTD.lib(fseek.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _ftell already defined in LIBCMTD.lib(ftell.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isalpha already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isxdigit already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fwrite already defined in LIBCMTD.lib(fwrite.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strtol already defined in LIBCMTD.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _strtoul already defined in LIBCMTD.lib(strtol.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isdigit already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fputc already defined in LIBCMTD.lib(fputc.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _sprintf already defined in LIBCMTD.lib(sprintf.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isspace already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _memchr already defined in LIBCMTD.lib(memchr.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _fflush already defined in LIBCMTD.lib(fflush.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isalnum already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _atoi already defined in LIBCMTD.lib(atox.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __lseeki64 already defined in LIBCMTD.lib(lseeki64.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _getenv already defined in LIBCMTD.lib(getenv.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isupper already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _islower already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isprint already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: _isgraph already defined in LIBCMTD.lib(_ctype.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info##AAE#ABV0##Z) already defined in LIBCMTD.lib(typinfo.obj)
1>MSVCRTD.lib(ti_inst.obj) : error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info##AAEAAV0#ABV0##Z) already defined in LIBCMTD.lib(typinfo.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __read already defined in LIBCMTD.lib(read.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __write already defined in LIBCMTD.lib(write.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __strnicmp already defined in LIBCMTD.lib(strnicmp.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __close already defined in LIBCMTD.lib(close.obj)
1>MSVCRTD.lib(MSVCR110D.dll) : error LNK2005: __open already defined in LIBCMTD.lib(open.obj)
1>LINK : warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>libcurld.lib(easy.obj) : error LNK2019: unresolved external symbol __imp__WSAStartup#8 referenced in function _win32_init
1>libcurld.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__WSAStartup#8
1>libcurld.lib(easy.obj) : error LNK2019: unresolved external symbol __imp__WSACleanup#0 referenced in function _win32_cleanup
1>libcurld.lib(telnet.obj) : error LNK2001: unresolved external symbol __imp__WSACleanup#0
1>libcurld.lib(misc.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(openssl.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(telnet.obj) : error LNK2019: unresolved external symbol __imp__WSAGetLastError#0 referenced in function _printsub
1>libcurld.lib(tftp.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(ftp.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(asyn-thread.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(select.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(sendf.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(connect.obj) : error LNK2001: unresolved external symbol __imp__WSAGetLastError#0
1>libcurld.lib(global.obj) : error LNK2019: unresolved external symbol _OPENSSL_add_all_algorithms_noconf referenced in function _libssh2_init
1>libcurld.lib(openssl.obj) : error LNK2001: unresolved external symbol _OPENSSL_add_all_algorithms_noconf
...
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_load_error_strings referenced in function _Curl_ossl_init
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_SESSION_free referenced in function _Curl_ossl_session_free
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_set_session referenced in function _ossl_connect_step1
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_get_peer_certificate referenced in function _servercert
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_get_peer_cert_chain referenced in function _verifystatus
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_CTX_set_verify referenced in function _ossl_connect_step1
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_CTX_set_default_passwd_cb referenced in function _cert_stuff
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_CTX_set_default_passwd_cb_userdata referenced in function _cert_stuff
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_CTX_check_private_key referenced in function _cert_stuff
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_new referenced in function _cert_stuff
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_free referenced in function _Curl_ossl_close
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_connect referenced in function _ossl_connect_step2
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_read referenced in function _Curl_ossl_shutdown
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_peek referenced in function _Curl_ossl_check_cxn
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_write referenced in function _ossl_send
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_ctrl referenced in function _verifystatus
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_CTX_ctrl referenced in function _ossl_connect_step1
1>libcurld.lib(openssl.obj) : error LNK2019: unresolved external symbol _SSL_get_error referenced in function _Curl_ossl_shutdown
...
1>C:\Users\zdenik\Documents\GitProjects\Predictor\Debug\Predictor.exe : fatal error LNK1120: 213 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
My question is simple. What could be wrong with my project properties settings or how to set libcurld.lib properly?
I finally done it. I downloaded precompiled version of libcurl for Windows 32bit, but before I compiled code, I noticed there is error in char outfilename[FILENAME_MAX] = "C:\Users\zdenik\Documents\GitProjects\Predictor\Files\" row. It is needed to add name of the file at the end of the path string - C:\Users\zdenik\Documents\GitProjects\Predictor\Files\file.csv e.g. It would not cause compile error but app would crash after it's triggering.
After that code compiled successfully.

error lnk2019: unresolved external symbol __imp_ fftw_plan_dft_r2c_2d referenced in function in .obj file

Error 4 error LNK2019: unresolved external symbol __imp_fftwf_cleanup referenced in function "int __cdecl ace_enhance_image_interp(float *,float const *,int,int,float,char const *,int)" (?ace_enhance_image_interp##YAHPEAMPEBMHHMPEBDH#Z)
Error 3 error LNK2019: unresolved external symbol __imp_fftwf_destroy_plan referenced in function "int __cdecl compute_omega_trans(float *,float *,int,int,char const *)" (?compute_omega_trans##YAHPEAM0HHPEBD#Z)
Error 1 error LNK2019: unresolved external symbol __imp_fftwf_execute referenced in function "int __cdecl compute_omega_trans(float *,float *,int,int,char const *)" (?compute_omega_trans##YAHPEAM0HHPEBD#Z)
Error 6 error LNK2019: unresolved external symbol __imp_fftwf_free referenced in function "int __cdecl ace_enhance_image_interp(float *,float const *,int,int,float,char const *,int)" (?ace_enhance_image_interp##YAHPEAMPEBMHHMPEBDH#Z)
Error 5 error LNK2019: unresolved external symbol __imp_fftwf_malloc referenced in function "int __cdecl ace_enhance_image_interp(float *,float const *,int,int,float,char const *,int)" (?ace_enhance_image_interp##YAHPEAMPEBMHHMPEBDH#Z)
Error 2 error LNK2019: unresolved external symbol __imp_fftwf_plan_r2r_2d referenced in function "int __cdecl compute_omega_trans(float *,float *,int,int,char const *)" (?compute_omega_trans##YAHPEAM0HHPEBD#Z)
Error 7 error LNK1120: 6 unresolved externals
These are the errors im getting when trying to build the code?can some one please help me..
I linked the libraries correctly..I followed this page and did all which is said here... http://liuxingguang.blogspot.in/2012/05/use-fftw-in-c.html

fatal error LNK1120: 1 unresolved externals

how can i solve this ,when i compile my source im got this error
Neuz.exe : fatal error LNK1120: 1 unresolved
EditString.obj : error LNK2019: unresolved external symbol "public: void __thiscall CEditString::ParsingString(char const *,unsigned long,unsigned long,unsigned short,class ATL::CStringT<char,class StrTraitMFC<char,class ATL::ChTraitsCRT<char> > > &,class CDWordArray &,class CByteArray &,class CWordArray &,unsigned long)" (?ParsingString#CEditString##QAEXPBDKKGAAV?$CStringT#DV?$StrTraitMFC#DV?$ChTraitsCRT#D#ATL#####ATL##AAVCDWordArray##AAVCByteArray##AAVCWordArray##K#Z) referenced in function "public: void __thiscall CEditString::AddParsingString(char const *,unsigned long,unsigned long,unsigned short,unsigned long)" (?AddParsingString#CEditString##QAEXPBDKKGK#Z)
If the class CEditString is implemented in one of your source files then add the source file to your project.
If the class CEditString is implemented in a library (.LIB) then add the library to your project.
If the class CEditString is implemented in a DLL then add the import library to your project.
In the latter two cases verify that you have included the correct and unchanged header files matching the exported symbols. You can use dumpbin to see the exported symbols of the LIB and the DLL.

Qt 4.8.2 + vs2010 + static + project build issues LNK2019 & LNK2005

I had successfully compiled a static version of qt4.8.2 by following the instructions from this post http://www.holoborodko.com/pavel/2011/02/01/how-to-compile-qt-4-7-with-visual-studio-2010/
However, I encountered a list of errors when compile my project, they are LNK2019 & LNK2005 related.
I attached the error messages at the bottom.
For the LNK2005 related errors , I included LIBCMT at Linker->Input->Ignore Specific Default Libraries, and its related errors disappear from the error list, but is that the right way to do it?
For the LNK2019 related errors, I couldn't resolve them, please give me some instructions.
Here is my project settings:
C/C++ -> Code Generation -> Runtime Library: Multi-threaded Debug (/MTd)
C/C++ -> Language -> Treat WChar_t As Built in Type: No ( /Zc:wchar_t- )
Linker-> Input -> Additional Dependencies:
Imm32.lib
Ws2_32.lib
winmm.lib
qtmaind.lib
QtCored.lib
QtGuid.lib
wsock32.lib
LNK2019 related error messages:
- Error 161 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: class std::basic_string<char,struct
std::char_traits<char>,class std::allocator<char> > __thiscall
QString::toStdString(void)const "
(__imp_?toStdString#QString##QBE?AV?$basic_string#DU?$char_traits#D#std##V?$allocator#D#2##std##XZ)
referenced in function "private: void __thiscall
MainForm::on_actionConfiguration_triggered(void)"
(?on_actionConfiguration_triggered#MainForm##AAEXXZ) C:\Working\ProjLocation\test\mainform.obj test
- Error 163 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: class QString & __thiscall
QString::append(char const *)" (__imp_?append#QString##QAEAAV1#PBD#Z)
referenced in function "private: void __thiscall
MainForm::summaries_series(struct series const *)"
(?summaries_series#MainForm##AAEXPBUseries###Z) C:\Working\ProjLocation\test\mainform.obj test
- Error 162 error LNK2019: unresolved external symbol
"__declspec(dllimport) public: __thiscall QString::QString(char const
*)" (__imp_??0QString##QAE#PBD#Z) referenced in function "private: void __thiscall MainForm::on_actionLogin_triggered(void)"
(?on_actionLogin_triggered#MainForm##AAEXXZ) C:\Working\ProjLocation\test\mainform.obj test
LNK2005 related error messages:
- Error 12 error LNK2005: __set_invalid_parameter_handler already defined in LIBCMTD.lib(invarg.obj) C:\Working\ProjLocation\test\LIBCMT.lib(invarg.obj) test
<more LIBCMT & LIBCMTD related errors…..>
- Error 17 error LNK2005: “void __cdecl _invalid_parameter(unsigned short const *,unsigned short const *,unsigned short const *,unsigned int,unsigned int)” (?_invalid_parameter##YAXPBG00II#Z) already defined in LIBCMTD.lib(invarg.obj) C:\Working\ProjLocation\test\LIBCMT.lib(invarg.obj) test
The default Qt project's properties created by the vs add-in was changed, after I re-compiled the Qt source.

Resources