The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 printf problem
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

bwitkamp

Netherlands
Posts

Posted - 03/15/2005 :  05:48:00 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version 7.0 sr1:
Operating System: windows xp

dear all,

I have this really dumb problem. My computer broke down, so I had to reinstall origin 7.0 on my new copmuter. However since then, I am unable to run even the most simple scripts. It always returns a "command error". I reinstalled it twice with the same effect. For example if I run the simple "hello world" example:

#include <stdio.h>

void main(void)
{
printf("Hello, World!\n");

return 0;
}

I get " command error!!!"

Could anyone please help me

thanks

Benoit

Mike Buess

USA
3037 Posts

Posted - 03/15/2005 :  09:31:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Benoit,

I don't think you've added the file containing the "Hello World" function to your Origin C Workspace and compiled.

1. Select File->Add To Workspace
2. Select Tools->Build and you'll see these compiler messages (subtitute your file name for Test2.c)...

>compiling...
>Test2.c
>D:\OriginLab\OriginPro70\OriginC\Test2.c(29) :Error, Invalid "return" statement
>D:\OriginLab\OriginPro70\OriginC\Test2.c(29) :Error, general compile error
>D:\OriginLab\OriginPro70\OriginC\Test2.c(25) :Error, error(s) found in compiling function main
>
>Compiling errors found, linking cannot start!

3. Delete the "return 0;" statement and Build again. This time you will see no error messages.

Now enter "main" in the script window and you'll see your "Hello World" message.


Mike Buess
Origin WebRing Member
Go to Top of Page

bwitkamp

Netherlands
Posts

Posted - 03/16/2005 :  3:33:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Mike,

I tried your suggestion, however I still got an error. For simplicity I took a screenshot of the problem, and put it on my homepage.

the link is http://qt.tn.tudelft.nl/~bwitkamp/screenshot.JPG

Please help me out....

regards,

Benoit

Edited by - bwitkamp on 03/16/2005 3:39:21 PM
Go to Top of Page

easwar

USA
1965 Posts

Posted - 03/16/2005 :  3:45:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Benoit,

From the image it looks like what you did was to create a new .OGS file and not a new .C file.

OGS files are files that contain LabTalk script. You cannot place C code in them and compile and run.

To create a new C file, use the File->New command in Code Builder, and in the dialog that comes up, make sure to select "C File" at the top of the list. Then you can also check the "Add to Workspace" checkbox so that the newly created file is already added to your workspace. Then put in your code and build as Mike described above. You will then see the statement in the output window that specifically says your file has been compiled, which is of course missing in your image becuase the file is .OGS and so it does not get compiled at all.

Easwar
OriginLab

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000