Problems with running code converted from C#.

This is a discussion on Problems with running code converted from C#. within the C++ Programming forums, part of the General Programming Boards category; Hi! I have used Tangible Software Soultion's tool to translate a C# code to C++, which resulted in: Code: //Welcome.h ...

  1. #1
    Registered User
    Join Date
    Jul 2009
    Posts
    7

    Problems with running code converted from C#.

    Hi!

    I have used Tangible Software Soultion's tool to translate a C# code to C++, which resulted in:

    Code:
    //Welcome.h
    
    #include <iostream>
    using namespace std;
    
    // Program start class
    class WelcomeCSS
    {
    // Main begins program execution.
    static void Main()
    {
    // Write to console
    std::cout << "Welcome to the C# Station Tutorial!" << std::endl;
    }
    };
    When I run it on my linux system, I get the error "Permission denied". I am new to C++. What could possibly be wrong with this code? I can run another C++ code from the same location without any trouble. Does anyone know a good tool to translate C# code to C++? Thank you your help!

    ~ Elena

  2. #2
    C++まいる!Cをこわせ! Elysia's Avatar
    Join Date
    Oct 2007
    Posts
    22,173
    For one thing, Main should be main and a global function. Not to mention that all the members in the class are private, which you probably don't want.
    I hate to say it, but this converter doesn't seem very good if it cannot even produce a proper main function.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.
    For information on how to enable C++11 on your compiler, look here.
    よく聞くがいい!私は天才だからね! ^_^

  3. #3
    Registered User
    Join Date
    Jul 2009
    Posts
    7
    Thank you, Elysia. Indeed, I need a main. Probably, my C# example didn't have that, and therefore it got converted wrong. I will check it now.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I can't figure out why this C code is running so slow...
    By Stachelsk in forum C Programming
    Replies: 7
    Last Post: 01-28-2010, 07:01 AM
  2. open source code compile problems - modbus stack
    By noob in forum C Programming
    Replies: 2
    Last Post: 10-16-2009, 08:04 PM
  3. Tidying up Code and Compile Problems
    By suchthefool in forum C Programming
    Replies: 3
    Last Post: 08-11-2009, 02:42 PM
  4. Problems With C++ Code ( from a book )
    By thetechall in forum C++ Programming
    Replies: 6
    Last Post: 08-10-2009, 05:39 PM
  5. running code in borland
    By Aisthesis in forum Tech Board
    Replies: 5
    Last Post: 05-19-2009, 12:06 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21