You are here

C++ compiler

I have a question concerning the GNU C++ compiler.

When I choose the Build in C++ command from the Model menu I can follow the processing of the compiler but finally I am not transferred to the Run Time Environment. Besides, when I choose Export as C++ code, the cpp file is not created. I consider those to be signs that the compiler is not working properly.

I started the compiler from the command window to exclude that the path problem is responsible for that behaviour. In the Preferences I have checked the GNU compiler for C++ distributed with Simile, to avoid any trouble. I do never receive any error or warning messages.

How can I solve this problem?

Forums: 

Please tell me a couple more things:
(i) Does everything work fine when you build the model in Tcl?
(ii) Do you get no error messages when attempting to export a c++ program?
--Jasper

jaspert wrote:
Please tell me a couple more things:
(i) Does everything work fine when you build the model in Tcl?
(ii) Do you get no error messages when attempting to export a c++ program?
--Jasper

Dear Jasper,

thanks for replying to my message.

To answer your questions:

ad i.) I have neither problems to build models in TCL nor to run models (presumably after they have been built in TCL automatically, however, I have not checked this).

ad ii) There are no error messages, when I try to export the C++ code. The cpp file to be created is simply absent from the chosen folder.

However, after I checked the button "Pause to edit C++ code?" in the Edit/Preferences/Build Menu I received the following error message, when attempting to Build a model (move1) in C++: "Failed to load the compiled model. The operating system returned the following message: could not load the file: C:/Docs_and_Settings/User/Local_Settings/Temp/sim32115/Desktop/model.dll. The module in question was not found. - the program will attempt to build another one." The processing stopped at "Generating constant declarations." and then quit.

Hope, this can make things clearer.

Do you have any ideas, what goes wrong here?

Best regards, Uwe

I'm puzzled here -- it does not seem to be anything to do with the compiler, rather Simile is failing to create the c++ program that goes into the compiler. I have no idea why. When you have this message displayed:

C:/Docs_and_Settings/User/Local_Settings/Temp/sim32115/Desktop/model.dll. The module in question was not found. - the program will attempt to build another one."

Is there a file called model.cpp in the same directory where it is looking for model.dll?

Also, does the same problem occur even with an empty model window?

And, is there anything unusual about your setup, e.g., you have directories with Far Eastern characters in their names, or your documents are on a network drive? Just clutching at straws here.

--Jasper

jaspert wrote:
I'm puzzled here -- it does not seem to be anything to do with the compiler, rather Simile is failing to create the c++ program that goes into the compiler. I have no idea why. When you have this message displayed:

C:/Docs_and_Settings/User/Local_Settings/Temp/sim32115/Desktop/model.dll. The module in question was not found. - the program will attempt to build another one."

Is there a file called model.cpp in the same directory where it is looking for model.dll?

Also, does the same problem occur even with an empty model window?

And, is there anything unusual about your setup, e.g., you have directories with Far Eastern characters in their names, or your documents are on a network drive? Just clutching at straws here.

--Jasper

Dear Jasper,

some answers to your new questions:

There is no model.cpp file on my hard drive. Even the directory c:\Dokumente_und_Einstellugen\Uwe\Lokale_Einstellungen\Temp\sim26980\Desktop is lacking.

Some more things I tried: entered once again the path environment variable in my operating system (Windows 2000). Invoked the batch file for my Visual C++ compiler, changed the Preferences to the Microsoft compiler afterwards. When I attempted now to build in C++, I received the error message: "cl" file could not be found.

Things do not change when I invoke the Build in C++ with an empty SIMILE model as you suggested.

Is there anything special on my machine?
Well, what comes to my mind is: I am using a screen magnifier, because I am low-vision. However, in the past this caused only problems, when I was working with Java programs. But this is a problem known to the developers of the magnification software.

Certainly, I do use a German Windows Version as you can see from the above directory information. Neither my data files nor the programs are located on a network, although I am connected to a standard gateway machine over a LAN. I do not use Eastern characters.

Uwe

Well I'm sorry to say I have no idea where to start! It is baffling that you are able to create and execute tcl programs but not c++ programs, and that no-one else has reported a problem like this. I can only suggest two things:

(i) Install vncserver on your PC and let me try to debug the problem remotely while you're not using it, or

(ii) We will shortly be sending an early version of Simile 4.0 to beta testers, This version has many changes from Simile 3.3 including better error reporting and logging facilities, so I would suggest you help us with beta testing in the hope that if there is any problem with Simile we can nail it before version 4.0 goes into production.

Thanks for your co-operation
--Jasper

jaspert wrote:
Well I'm sorry to say I have no idea where to start! It is baffling that you are able to create and execute tcl programs but not c++ programs, and that no-one else has reported a problem like this. I can only suggest two things:

(i) Install vncserver on your PC and let me try to debug the problem remotely while you're not using it, or

(ii) We will shortly be sending an early version of Simile 4.0 to beta testers, This version has many changes from Simile 3.3 including better error reporting and logging facilities, so I would suggest you help us with beta testing in the hope that if there is any problem with Simile we can nail it before version 4.0 goes into production.

Thanks for your co-operation
[Jasper

Hello Jasper,

Thanks for the two phantastic suggestions.

Certainly, I will be very happy to beta-test the new version and see the new feaures first hand.

I have also installed the VNC server/viewer on my PC. So you can also remotely access SIMILE on my computer now. I think, it is better to make the necessary arrangements by private messaging. Depending on the kind of problem, a short final note could be helpful to others. If I am able to explain it, I will do this.

Uwe

OK I'll have a go. When you're ready, start the vncserver running, and mail me your IP address and vncserver password -- I can then connect and try to debug this problem. My email address is @
.com (fill them in so I don't get spammed)

Cheers
--Jasper

OK, sorry I gave out the wrong email address -- you should leave the 't' off the end of my username. But I was able to get the info and run a VNC session on your computer.

The basic problem is that you do not have the 'path' set up correctly for the GNU compiler. You have separated the location of the GNU .exe files from the rest of the path with a backslash (\) character, while it should be separated with a semicolon (;) character. I could not put this right for you because due to my limited German I could not find the dialogue for editing the path, but I'm sure you can sort it out yourself.

The reason you could not find the c++ code before compilation is that the 'temp' folder is inside a hidden folder. but don't worry, it is there. Unfortunately in version 3.3 exporting c++ code does not work if the compiler is not set up correctly -- this will be fixed in version 4.0.

In general, after installing the Mingw c++ compiler and setting the path to include its executables, it is a good idea to test it by getting up a command prompt and typing:
g++ -v
This will return information about the compiler if the path has been set correctly, and an error if it has not.

Hope this helps
--Jasper

jaspert wrote:
OK, sorry I gave out the wrong email address -- you should leave the 't' off the end of my username. But I was able to get the info and run a VNC session on your computer.

The basic problem is that you do not have the 'path' set up correctly for the GNU compiler. You have separated the location of the GNU .exe files from the rest of the path with a backslash (\) character, while it should be separated with a semicolon (;) character. I could not put this right for you because due to my limited German I could not find the dialogue for editing the path, but I'm sure you can sort it out yourself.

The reason you could not find the c++ code before compilation is that the 'temp' folder is inside a hidden folder. but don't worry, it is there. Unfortunately in version 3.3 exporting c++ code does not work if the compiler is not set up correctly -- this will be fixed in version 4.0.

In general, after installing the Mingw c++ compiler and setting the path to include its executables, it is a good idea to test it by getting up a command prompt and typing:
g++ -v
This will return information about the compiler if the path has been set correctly, and an error if it has not.

Hope this helps
--Jasper

Dear Jasper,

thank you very much for looking at my local settings using VNC. I followed your actions in the VNC session and even wanted to help you with the German Wiindows version by opening a Word window to communicate with you. Howver, you were too fast.

I have also tested the g++ command previously and did not get the error that the file could not be recognized. Instead, I received the message that no cpp filename was specified and interpreted this message in the way, that the g++ file was found in the search path. However, I have two g++ files on my hard drive (one by Cygnus) and the Cygnus g++ is also referred to in the path. I am not sure what rules are followed by the OP (first directory in the path comes first ?).

Nevertheless, your diagnosis helped.

I corrected the typing error in the path and for safety I put the Programs\MinGW\bin in the first place on the path.

By the way: I found good instructions for the installation of MinGW and the required path setting for various Windows versions at: http://csjava.occ.cccd.edu/~gilberts/mingw/

Now, Building in C++ works fine. Thanks for the help.

Uwe