I want my Simulink project run some simple command e.g "mkdir folder"
I found a way that I could use s-function. So I added a S-function builder block in Simulink and it works but It can not be generated when I use Simulink-coder to generate cpp code.
there are the code that I add in S-function builder block
#include<windows.h>
....some initial code from builder
void NAME_Outputs_wrapper(const real_T *u0,
real_T *y0)
{
WinExec("SOME COMMAND",SW_HIDE);
}
The error shows the project always missing some cpp header file like windows.h. It seems Simulink will not detect the system environment. If I copied all the related header file into the project folder, It becomes something is undefined or undeclared.
I would like know if it is possible to use s-function to run command and this Simulink model still could generated. Or other better idea I would be grateful.
Related
I'm trying to develop C++ code in VS Code on a mac. I have no problems building and debugging. However, my editor is full of red ink. Is there a way to fix my editor so it is as smart as the compiler?
Here's a simple example: https://github.com/TradeIdeasPhilip/compress/tree/master/mac-os/eight. I can open this folder in VS code and build and run, but the editor is ugly.
One of the first error messages is on line 22 of EightShared.C:
const std::string preloadContents = "\xdc\xe4\xeb\xf1\xf6\xfa\xfd\xff";
This should be very straightforward. It's a string constant. I'm importing <string> through another header file. (And adding directly to the top of this file did not make a difference.) But VS code marks the first : in red and when I hover over it I see expected a ; and when I ask it to help me, it offers to disable the red squiggles.
The editor also complains about the class keyword on line 31 even though it accepts classes in other files.
The editor also complains about most (but not all) references to types like uint32_t even though I #include <stdint.h> and that works without any red ink. Here's an example from EightShared.h
Those are just a couple of samples. My editor is filled with red marks.
I'm using Microsoft's C++ extensions for VS Code. I'm guessing that one of these needs to be configured better.
Any thoughts on how to get rid of all of these red marks? Maybe a sample of a working config file or a suggestion of what I'm doing wrong? Thanks.
I eventually found a problem in my .vscode/c_cpp_properties.json file. I removed "/Library/Developer/CommandLineTools/usr/include/c++/v1" from the "includePath". Then intellisense started working again.
I have no idea how that line got into that file. I certainly didn't type it.
The change in GitHub.
I'm trying to change the code in an HTML file and add two lines of code:
document.open()
document.write(year) //this was already here
document.close()
but when I run the code it ignores the changes and just gives me this when I use F12:
document.write(year)
I have a VB6 project that I didn't create but I have to update, when I go to make the exe I get a compile error: Method or data member not found, and it points too "SCom1.FileReceive" in the code below. When I look at the Main form, the SCom1 control is a PictureBox.
This code has been working for the last 5 years but I don't know why SCom1 is a picturebox, or why I'm getting the error, is it a reference? SCom1 to me looks like a MSComm function? Let me know if anyone has any ideas, I just don't know VB enough to know how to troubleshoot this. Thanks
If SCom1.FileReceive = True Then
WriteToLog (Now() & " FileReceive was true, now false")
SCom1.FileReceive = False
End If
The machine which you have opened the code doesn't have the mscomm32.ocx file or the ocx file not registered properly.
When vb cannot reference an ocx, it'll convert the relevant control to a picture box control.
What you have to do is, close the project without saving. Then open system32 folder and check for mscomm32.ocx file. If the file is not there then you have to download that from the intenet. The register the file using regsvr32 command in command prompt.
After this you can open the vb6 project and start working.
=========================================================
EDIT : Included the update in the comments to the answer, this will help other users in the future... :-)
if the method name doesn't look familiar to a known ocx file (in this case the SCom1.FileReceive), the missing component can be a custom ocx file.
So check on the working machine or in project folder whether there are any ocx file exists in the relevant name (in this case SCom.ocx).
if there is a file exists in such name, register that file using regsvr32 (if not registered), then add that to toolbox, then replace the picture box control with the relevant control (make sure the name tally).
I have a win 32 project I'm working on and the resource file were working fine till yesterday. Now when I try to open the resource file to edit, it crashes and gives me the following error:
C://program files/Microsoft SDKs/Windows/v6.0A/include/prsht.h(0)
error RC2247: Symbol name too long
Can anybody tell me where I might be going wrong or where to look into. The rc file is a very simple dialog box with a static text and a progress bar.
I had the error as well. The approach mentioned in the http://social.msdn.microsoft.com/Forums/{...} Link (in a comment from Michael Walz) should work. Here's what you have to do:
Find the part where the windows headers are included. This might be the "windows.h" include, or if you use MFC, it is the <afxres.h> include. Add the "prsht.h" header after your "windows.h" include (this did the trick for me). Also surround it with the two lines containing APSTUDIO_HIDDEN_SYMBOLS, to hide the lines from the resource editor. It should look like this:
#define APSTUDIO_HIDDEN_SYMBOLS
#include "windows.h"
#include "prsht.h"
#undef APSTUDIO_HIDDEN_SYMBOLS
1.download a tool named ResEdit,if you can't find this tool,can email to me.
juxuan_xatu#126.com
2.open the *.rc file.
3.click everyone diadlag, save it.
4.then use vc2008 to open it again.
I have some C code for an ARM926 target. I am trying to debug it using "Arm Xtended Debugger" (AXD). The main() of this code, takes 14 command line arguments which are mentioned in the code warrior project settings at proper place and behavior of the code is as expected.
But when I try to use the same AXF (Arm eXecutable Format file) file and try to do source level debugging using the RVDEBUG by changing the settings of the Codewarrior project, and start debugging, then the argc value is 1. Then the behavior of the code is unexpected.
When I select RVDEBUG in code warrior settings I give the same options as I used during AXD debug session.
So my question is:
I am using the same AXD for both the debugging sessions(AXD and RVDEBUG), why are they behaving differently? They should behave the same.
I don't use CodeWarrior but I know AXD and RVD: I remember Code Warrior can invoke AXD with the suitable arguments for the image, and so on. I don't know if Code Warrior can invoke RVD as well. So I suppose you run RVD yourself, outside any Code Warrior menu, don't you?
Then you just have to add the arguments in the dedicated input box at the bottom of the Load Image menu.
If this still does not work, I suggest you have a look at the semihosting options (they're rather in the connections options of RVD than in Code Warrior's).
Good luck!