problem with creating mat files from C++ (visual studio 2005)

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi,

I am having trouble creating mat files from my visual studio 2005
express. For example, the
matcreat.c file that is given as an example in the mathworks site,
produced 13 linking errors of this type:

1>Linking...
1>matcreat.obj : error LNK2019: unresolved external symbol _mxGetString
referenced in function _main
(...)

this happened although I set up the VC++ directories for include files
and libraries to point to the matlab\extern\include and
matlab\extern\lib\ respectively.

Any help will be greatly appreciated. Thank you
ilias

PS. Some secondary questions I have:
(a) mex -setup "sees" only the lcc compiler and not the msvc as it
should from visual studio 2005. I did add the cl.exe path to the
environmental variable path but the result is the same. I recently
installed the 9.1 intel compiler, same problem.
(b)If you have played with vms isual c++ 2005, there is supposed to be
a "compile tab" in the solution manager. Any thoughts why there is not
in mine ?

0
Reply iliast (9) 6/10/2006 6:39:37 AM

See related articles to this posting


This is not a problem associated with "mat files" exactly. You're obviously 
using some library routines from somewhere and have not included them 
correctly in your project.

So the question is: What library are you using, and how are you including it 
in your project?

-- 
Jonathan Wood
SoftCircuits Programming
http://www.softcircuits.com

"ilias" <iliast@gmail.com> wrote in message 
news:1149921577.837903.252670@h76g2000cwa.googlegroups.com...
> Hi,
>
> I am having trouble creating mat files from my visual studio 2005
> express. For example, the
> matcreat.c file that is given as an example in the mathworks site,
> produced 13 linking errors of this type:
>
> 1>Linking...
> 1>matcreat.obj : error LNK2019: unresolved external symbol _mxGetString
> referenced in function _main
> (...)
>
> this happened although I set up the VC++ directories for include files
> and libraries to point to the matlab\extern\include and
> matlab\extern\lib\ respectively.
>
> Any help will be greatly appreciated. Thank you
> ilias
>
> PS. Some secondary questions I have:
> (a) mex -setup "sees" only the lcc compiler and not the msvc as it
> should from visual studio 2005. I did add the cl.exe path to the
> environmental variable path but the result is the same. I recently
> installed the 9.1 intel compiler, same problem.
> (b)If you have played with vms isual c++ 2005, there is supposed to be
> a "compile tab" in the solution manager. Any thoughts why there is not
> in mine ?
> 


0
Reply jwood (6) 6/10/2006 5:54:33 PM

Thanks for your reply. Including these two libraries , solves the
problem.

#pragma comment(lib, "libmat.lib")
#pragma comment(lib, "libmx.lib")

Does anyone have an answer to the other two questions, namely why mex
-setup can't see the msvc compiler and why there is no compile tab in
the solution explorer?

Thanks !
ilias

0
Reply iliast (9) 6/10/2006 6:45:31 PM
comp.soft-sys.matlab 203214 articles. 525 followers. Post

2 Replies
240 Views

Similar Articles

[PageSpeed] 29


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Problems when compiling and linking MAT-file program using Microsoft Visual Studio C++ 6.0
Hi, all, I tried to call the external API provided by MATLAB in C program,which I want to compile,link and run on Microsoft Visual Studio C++ 6.0. I added the C:\Program Files\MATLAB\R2007a\extern\include and C:\Program Files\MATLAB\R2007a\extern\lib in the "Include Files" and "Library Files" of MVSC++. Then I copied an example code matcreate.c(under C:\ProgramFiles\MATLAB\R2007a\ extern\examples\eng_mat) to the C++ source file. Then sucessfully compiled this file, however, when operated link command, errors appeard as followings: ---------Configuration: MATLAB_MX - Wi...

Problem with Visual C++ 2005 Express and file ntwin32.mak
Hi, I've installed the following setup. - Matlab R2008a - National Instruments SIT 5.0 - Visual C++ 2005 Express Edition I've configured the mex compiler with 'mex -setup', but every time i try to build a simulink model for the NI target I get the following error E:\Dev\Esempio\ProcessoTermico_nidll_rtw>nmake -f ProcessoTermico.mk GENERATE_REPORT=0 Microsoft (R) Program Maintenance Utility Version 8.00.50727.42 Copyright (C) Microsoft Corporation. All rights reserved. C:\PROGRA~1\MATLAB\R2008a\rtw\c\tools\vctools.mak(16) : fatal error U1052: file 'ntwin32....

Reading mat-files in c++, visual studio 64 bit
Hi! I'm doing some numerical experiments on the GPU. My main program is in C/C++ and I use Visual Studio 2008. As a part of my program I need to read some mxArray's from a mat-file, as I am doing some preprocessing on a mesh using matlab. I previously did my coding in a 64-bit linux environment, and had no problems using the libmat and libmx functionality. When I moved over to 64-bit windows 7 with visual studio, my program stopped working. Everything compiles just fine, it is the linking and running that won't work. It seems like it can't recognize the appropriate data in ...

How to create and use DLL file in Visual Studio 2010 C++ ?
Hello ! How to create and use DLL file in Visual Studio 2010 C++? How to use DLL file used LoadLibrary() ? many thanks! Tuấn Trần wrote: > Hello ! > How to create and use DLL file in Visual Studio 2010 C++? > How to use DLL file used LoadLibrary() ? Try asking on a windows or VS forum, this isn't really the place to ask. -- Ian Collins =?UTF-8?B?VHXhuqVuIFRy4bqnbg==?= <trananhtuan260493@gmail.com> wrote in news:42c32a4d-ea0c-481b-bcd9-30834e60fae1@googlegroups.com: > Hello ! > How to create and use DLL file in Visual Studio 2010 C++? > How...

What setting I need to change in Visual Studio C++ v8 to run the same file that we have changed into .c after executing it as an .m file
??? ??? Jan ...

Just wondering if anyone knows if there are converters to convert from: MS Visual C++ 6.0 or MS Visual Studio 2003 project files into UNIX autogen/configure/make files?
Just wondering if anyone knows if there are converters to convert from: MS Visual C++ 6.0 or MS Visual Studio 2003 project files into UNIX autogen/configure/make files? KevinGPO wrote: > Just wondering if anyone knows if there are converters to convert from: > > MS Visual C++ 6.0 or > MS Visual Studio 2003 > > project files into UNIX autogen/configure/make files? > A better place to ask would be a UNIX newsgroup or a Linux newsgroup, comp.os.linux.development.apps, for example V "KevinGPO" <kevingpo@hotmail.com> wrote in message news:1126251633....

Is eMbedded Visual C++ 4.0 required when using Visual Studio 2005 Pro
I have LabVIEW 8.0.1 installed on my computer and want to install the LabVIEW 8.0.1f1 PDA module since I need to develop for Windows Mobile 5.0 targets. I first installed the four tools as described on the first section of the following link : &nbsp; <a href="http://digital.ni.com/public.nsf/allkb/AF586D34790A379886256D73005CAF13" target="_blank">http://digital.ni.com/public.nsf/allkb/AF586D34790A379886256D73005CAF13</a> &nbsp; Then, when I try to install the LabVIEW 8.0 PDA module (I guess I have to install if first since the labVIEW 8.0.1f1 PDA module...

Looking for some help, problems with C++ Dlls (Using Visual Studio C++ 6.0)
Hi everyone. Okay, I'm trying to dynamically link some dlls and I'm having some problems. I originally had a project that seems to work, but for the life of me I can't repeat the results. I used app wizard to create a simple Win32 Dynamic Linked library. the code is as follows: #include "stdafx.h" #include "stdio.h" int i = 0; BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { return TRUE; } void _stdcall InitDll(){ i = 1; } I build that and get 'TestD...

Newbie on permissions: ADO.NET, C++.NET, SQL SERVER 2005 EXPRESS, Visual Studio 2005
This is a very basic question, perhaps more of a Windows XP Professional OS permissions question than a dB or programming question: how to create and access SQL SERVER databases from an account other than "Administrator"; for example, from a "Power User" account? As anything other than an "Administrator" user (i.e. as a Power User), I keep getting (when I try from inside of MS Visual Studio 2005 development environment) the error message: "CREATE DATABASE permission denied in database 'master' Using the SQL Server Express Surface Area Configuration ...

Calling C from Fortran link problems (Compaq Visual Fortran 6.6 & MS Visual Studio 8)...
Dear newsgroup, I am trying to call some C/C++ code from Fortran, but I cannot link the fortran exe correcly. I have C code that wraps a C++ class. For example, a C function like: extern "C" void BB_Initialise(void) { if (BB_Object != NULL) delete BB_Object; BB_Object = new BlockInternals(); }; /* BB_Initialise */ The above C wrapper is built into a static lib, using Microsoft Visual Studio 8: cl -c -MT -W3 -EHsc -O2 -Gy -D "WIN32" -D "NDEBUG" -D "_WINDOWS" -D "_MBCS" -D "_LIB" "..\src\FortranCWrapper.cpp" -out:&...

Big Problem/Bug with new matfile command for partial mat file read/writes
Please look at this minimal example: -------------- %create a 1mb "incompressible" array one_meg = uint8(rand(1,1000,1000)*256); %choose a file, clear it and open it with write access testfile = 'D:\Data\PGRtest\testfile.mat'; system(['del "' testfile '"'] ); matObj = matfile(testfile,'Writable',true); %keep a copy of what we write to the file in memory for verification memcpy = zeros(50,1000,1000,'uint8'); %write the array 50 times to this file for i = 1:50 tic %store in file and memory in same fo...

Big Problem/Bug with new matfile command for partial mat file read/writes
Please look at this minimal example: -------------- %create a 1mb "incompressible" array one_meg = uint8(rand(1,1000,1000)*256); %choose a file, clear it and open it with write access testfile = 'D:\Data\PGRtest\testfile.mat'; system(['del "' testfile '"'] ); matObj = matfile(testfile,'Writable',true); %keep a copy of what we write to the file in memory for verification memcpy = zeros(50,1000,1000,'uint8'); %write the array 50 times to this file for i = 1:50 tic %store in file and memory in same fo...

Visual Studio 2005 C++ Resouces
Hello, I added to my.resouces ("Form1.pl - PL.resx") empty databaze date.mdb. How do can in my programme retrieve my empty database from my.resources in order to record this on hard disc? I ask about help and some example. I thx Kris Kris wrote: > Hello, > > I added to my.resouces ("Form1.pl - PL.resx") empty databaze date.mdb. > > How do can in my programme retrieve my empty database from my.resources in > order to record this on hard disc? > > I ask about help and some example. > > I thx > > Kris This post is off-topic here. C...

Creating .mat files with C++ code
I want to do exactly what the title says. Nothing fancy, I just want to manipulate my vectors in C++ because they are rather large, and I want to use the string function as well. I'm not sure how to change my options (matopts) file to read in .cxx files. I'd just prefer to use g++ to compile it outside of matlab, but I supose that is not possible since matlab is probably involved in generating the .mat files. Any help is appreciated as to how to get matlab to compile c++ files, using the mex command. Thanks, Brandon ...

Open mat file with Visual C++
Hi! I'm trying to open a mat file (Matlab v.7.7) using a function in C++ (VS 2003). I readed the Matlab Help and I followed the tips. The program compiles without any error and I can open the mat file, that is, the pointer to the file is not NULL. But when I try to use the matGetDir function, the pointer to the variable names is NULL and the number of variables is -1. I tried with a simple matfile containing two variables a=1 and b=2. I cannot understand what's happening... anybody can help me? Thanks! S. "Ramon " <sirmarhalt@hotmail.com> wrote in message &...

Visual Studio
I can't find any tutorial that will create an exe file from a J# project. Can anyone help me? Using Visual Studio .NET 2003 Sorry, never mind "Van Nastring" <van@yahoo.com> wrote in message news:brlq9t$4ql9m$1@ID-198839.news.uni-berlin.de... > I can't find any tutorial that will create an exe file from a J# project. > Can anyone help me? Using Visual Studio .NET 2003 > > ...

creat a .mat file from ansi c
Hi, i wanted to known if there is already a library available that allows me to create my own .MAT files from an ansi c program in without using the mat.h file from the matlab external interfaces. I mean, completely independant from matlab libraries for that matter. I have read the protocol and I think it is not hard to implement, but I was wondering if someone has already done that. Also, I can generate my files in a CSV format but I got tired of using the import wizard. Thx in advance, JC "jc Fuentes" <jcfuentes@gmail.com.without.this> wrote in message <g2qul...

Problems creating mexFunction for C-file
***************************************************** The following are the c-structs and the mex-function: ***************************************************** typedef struct { int X, Y, Z; } feature_t; typedef struct { int n; /* Number of features in the signature */ feature_t *Features; /* Pointer to the features vector */ float *Weights; /* Pointer to the weights of the features */ } signature_t; void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { int i,n; float *distance; double *feature1, *feature2, *weight1, *weight2; signature_t *sig1, *si...

creating mat-file by c++ code
Hello. I am trying to create mat-files using a standalone.exe written in c++. Everything is working fine, expect transferring data from my 2-dimensional vector to the mxArray. I didn't find out how to write the content of a float variable into a specific cell of the mxArray. Due to the special memory usage of the c++-vector, it is not possible to use a memcpy-command to transfer all data from the vector to the mxArray in one step. Thanks for help. Chris ...

Deployment with Visual Studio 2005 C++
I am new learning how to use Visual Studio 2005 to program in C++. I have been having trouble deploying my applications onto another computer. I also use the Bloodshed Dev C++ compilier and when I compile my program it creates a exe that I can simply copy onto another computer and it will run. However, with Visual Studio I must create a setup project. I have tried using the help system and it didn't give me simple enough steps for me to complete my setup project. I am wriing win32 console applications (I just completed an introduction to C++ course) and according to the help I need to...

Link Error in creating Mat-File in C
I am a new user. And I tried to follow what was proposed in the techdoc/matlab_external part of matworks.com pages. I have windows 98 OS and the compiler is MSVC (Version 5.0). Following the matworks.com pages first I prepared the matopts.bat file using the mex -setup from the dos command line. I have selected MSVC (Version 5.0) compiler. (The C Mat-File is that given as an example in the techdoc/matlab_external pages). So from the command line I executed the mex -f c:\matlabR12\bin\win32\MEXOPTS\MATOPTS.BAT MATCREAT.C Result: Microsoft (R) 32-Bit Incremental Linker...

Compile C program in Visual Studio 2005
Sorry if this sounds stupid. I am a total newbie.... Can I compile C program in Visual Studio 2005 IDE? I wrote the simple "Hello World" program in it: ------------------------------------ #include <stdio.h> main() { printf("hello, world!\n"); } -------------------------------------- When I run it, it gives me the following: ------------------------------------------------------------------------- 'HelloWorld2.exe': Loaded 'D:\VS\Projects\HelloWorld2\debug\HelloWorld2.exe', Binary was not built with debug information. 'HelloWorld2.exe...

CreateProcess Loop Problem (Visual C++ 2005)
When I call the method perform_single_upload() in this loop: ---------------------------- private: System::Void start_uploads(int i) { i = 0; while(i < master_list->Length) { //Create a single batch file containing the upload instructions create_single_upload(i); //Increment loading bar pb_Progress->Value::set(pb_Progress->Value::get() + 1); //Load and perform the batch file contents perform_single_upload(); //Increment loading bar pb_Progress->Value::set(pb_Progress->Value::get() + 1); //Delete the batch file in preparation for the next one clea...

running .c files in Microsoft visual studio
I am a new user of C programming language. I have a .c file. What should I do to run this file on Microsoft visual studio ? Pratyush Srivastava said: > I am a new user of C programming language. I have a .c file. What > should I do to run this file on Microsoft visual studio ? See http://www.cpax.org.uk/prg/windows/vcprj.php -- Richard Heathfield <http://www.cpax.org.uk> Email: -http://www. +rjh@ "Usenet is a strange place" - dmr 29 July 1999 This line unintentionally left unblank Pratyush Srivastava wrote: > I am a new user of C programming language. I have a...