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. project doesn't build .exe?

project doesn't build .exe?

Scheduled Pinned Locked Moved C / C++ / MFC
c++workspacesysadminquestionlounge
6 Posts 3 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.
  • E Offline
    E Offline
    eggsovereasy
    wrote on last edited by
    #1

    Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have. #include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) {   system("setsdwperm.bat " + *argv[1]); } I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?

    T CPalliniC 2 Replies Last reply
    0
    • E eggsovereasy

      Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have. #include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) {   system("setsdwperm.bat " + *argv[1]); } I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      eggsovereasy wrote:

      system("setsdwperm.bat " + *argv[1]);

      oh my god !!! when you want to concatenate strings, you mustn't use the + operator !!! you have to use strcat(). moreover, system() is deprecated if you're targetting your code for a given plateform (for Windows, you should prefer ShellExecute() or CreateProcess() for instance).


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      E 1 Reply Last reply
      0
      • E eggsovereasy

        Because the Setup and Deployment project doesn't allow me to execute a batch file (why, is beyond me) I am making a simple c program to execute the batch file. Now its been a while since I've used C so after reading a little bit here is what I have. #include <stdio.h> #include <stdlib.h> int main(int argc, char * argv[]) {   system("setsdwperm.bat " + *argv[1]); } I got the project on the add new project dialog: Visual C++ -> General -> Empty Project When I look at the project properties under configuration properties it says Configuration Type is Application (.exe). But no .exe is produced when I build it. I get a log file, manifest, obj, dep, idb, and pdb files. What other setting do I need to change?

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

        Probably you are looking at the wrong place ([ADDED]provided you didn't make errors, see toxcct reply...). You ca check the value of the 'Output Directory' setting inside the 'Configuration Properties->General' window (Menu Project Properties). Or, if you prefer, you can check it in the linker command line (/OUT option). By default (I'm talking about VS2005) the executable is inside the 'debug' (or 'release') subfolder of the solution one. :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

        In testa che avete, signor di Ceprano?

        E 1 Reply Last reply
        0
        • CPalliniC CPallini

          Probably you are looking at the wrong place ([ADDED]provided you didn't make errors, see toxcct reply...). You ca check the value of the 'Output Directory' setting inside the 'Configuration Properties->General' window (Menu Project Properties). Or, if you prefer, you can check it in the linker command line (/OUT option). By default (I'm talking about VS2005) the executable is inside the 'debug' (or 'release') subfolder of the solution one. :)

          If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.

          E Offline
          E Offline
          eggsovereasy
          wrote on last edited by
          #4

          Yeah, with C# projects it puts all the compiled files in Solution Dir\Project Dir\Output Dir, but with this it was in Solution Dir\Output Dir. Thanks.

          1 Reply Last reply
          0
          • T toxcct

            eggsovereasy wrote:

            system("setsdwperm.bat " + *argv[1]);

            oh my god !!! when you want to concatenate strings, you mustn't use the + operator !!! you have to use strcat(). moreover, system() is deprecated if you're targetting your code for a given plateform (for Windows, you should prefer ShellExecute() or CreateProcess() for instance).


            [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

            E Offline
            E Offline
            eggsovereasy
            wrote on last edited by
            #5

            Ok, everything I try throws exceptions and I can't use the debugger with it? Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.

            T 1 Reply Last reply
            0
            • E eggsovereasy

              Ok, everything I try throws exceptions and I can't use the debugger with it? Any suggestions on how I would do this? all I need to do is combine "setsdwperm.bat " with the first argument and execute it.

              T Offline
              T Offline
              toxcct
              wrote on last edited by
              #6

              #include <stdio.h>
              #include <stdlib.h>

              int _tmain(int argc, TCHAR* argv[]) {
              TCHAR pszBuffer[256] = {0};
              strcpy(pszBuffer, _T("setsdwperm.bat"));
              strcat(pszBuffer, argv[1]);
              ShellExecute(NULL, _T("open"), pszBuffer, NULL, NULL, SW_SHOWNORMAL);
              }

              an even more easy way is this:

              #include <stdio.h>
              #include <stdlib.h>

              int _tmain(int argc, TCHAR* argv[]) {
              ShellExecute(NULL, _T("open"), _T("setsdwperm.bat"), argv[1], NULL, SW_SHOWNORMAL);
              }

              -- modified at 13:22 Monday 19th November, 2007


              [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

              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