Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. c++ help

c++ help

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
10 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 11193606
    wrote on last edited by
    #1

    i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?

    L CPalliniC 2 Replies Last reply
    0
    • U User 11193606

      i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Compile them into what? The compiler will turn source into object code, but that object still needs to be linked to the system libraries in order to run. Maybe you need to provide more information about exactly what your application is supposed to do.

      U 1 Reply Last reply
      0
      • U User 11193606

        i want to build a program that can compile simple codes like printf,scanf,etc. can iget any suggestions ? plus, can i add a third party compiler in a my program ?

        CPalliniC Offline
        CPalliniC Offline
        CPallini
        wrote on last edited by
        #3

        The simplest way is feeding an actual compiler with the code. You may use system[^], or ShellExectute[^], CreateProcess[^] for running the actual compiler. You can add a third party compiler to your application if the compiler's license allows it (I suppose you'll find a C compiler with such a liberal license).

        THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

        In testa che avete, signor di Ceprano?

        U 1 Reply Last reply
        0
        • L Lost User

          Compile them into what? The compiler will turn source into object code, but that object still needs to be linked to the system libraries in order to run. Maybe you need to provide more information about exactly what your application is supposed to do.

          U Offline
          U Offline
          User 11193606
          wrote on last edited by
          #4

          well, the application should have a compiler or compiling system for simple codes and i want to know if i can add a compling system to any application. If there is a way , please reply , Thanks for the reply anyway.

          L 1 Reply Last reply
          0
          • CPalliniC CPallini

            The simplest way is feeding an actual compiler with the code. You may use system[^], or ShellExectute[^], CreateProcess[^] for running the actual compiler. You can add a third party compiler to your application if the compiler's license allows it (I suppose you'll find a C compiler with such a liberal license).

            THESE PEOPLE REALLY BOTHER ME!! How can they know what you should do without knowing what you want done?!?! -- C++ FQA Lite

            U Offline
            U Offline
            User 11193606
            wrote on last edited by
            #5

            can you provide some info on adding compiler in my system, it would be great. Thanks for the reply.Your help was appreciated.

            A 1 Reply Last reply
            0
            • U User 11193606

              can you provide some info on adding compiler in my system, it would be great. Thanks for the reply.Your help was appreciated.

              A Offline
              A Offline
              Albert Holguin
              wrote on last edited by
              #6

              Member 11227854 wrote:

              can you provide some info on adding compiler in my system

              ...you just have to install it... :doh:

              U 1 Reply Last reply
              0
              • A Albert Holguin

                Member 11227854 wrote:

                can you provide some info on adding compiler in my system

                ...you just have to install it... :doh:

                U Offline
                U Offline
                User 11193606
                wrote on last edited by
                #7

                sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .

                M D 2 Replies Last reply
                0
                • U User 11193606

                  sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .

                  M Offline
                  M Offline
                  Maximilien
                  wrote on last edited by
                  #8

                  The compiler will be an external process (see above message from CPallini) for example, on windows you could do something like : If you edit the file in your own application, then you will need to save it on disk before compiling it.

                  // cl.exe is the windows compiler.
                  // yourfile.cpp is the source file you want to compile
                  system("cl.exe yourfile.cpp");

                  After that works (calling the compiler), you can try catching the compiler result (in case of errors and warnings) and display that to the user. This will work for simple 1 file program (with a valid main), if you want to compile and link multiple files (like visual studio do), then you will have to do a lot more work (using some sort of "make file"). Good luck. Max.

                  I'd rather be phishing!

                  1 Reply Last reply
                  0
                  • U User 11193606

                    well, the application should have a compiler or compiling system for simple codes and i want to know if i can add a compling system to any application. If there is a way , please reply , Thanks for the reply anyway.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    Member 11227854 wrote:

                    i want to know if i can add a compling system to any application.

                    Short answer: No. Longer answer: It is possible to compile a complete module by calling out to a compiler from an application via ShellExecute or similar. But just compiling simple statements in isolation would entail a very large amount of work.

                    1 Reply Last reply
                    0
                    • U User 11193606

                      sorry i couldnt understand what you are saying. The thing is that i am building a application that contains a compiler and i want to know how to add it. I am still a newbie so please elaborate .

                      D Offline
                      D Offline
                      David Crow
                      wrote on last edited by
                      #10

                      Member 11227854 wrote:

                      ...i am building a application that contains a compiler and i want to know how to add it. I am still a newbie...

                      Those two things typically do not go together well, at least not without a lot of prior knowledge. How about a less ambitious project (or two) to get you acquainted with C/C++/MFC development?

                      "One man's wage rise is another man's price increase." - Harold Wilson

                      "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

                      "You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups