4 Replies Latest reply on May 6, 2014 7:30 AM by Yuan M

    C++ Addin Unable To Start Program

    Yuan M

      Hi all,

       

      I've just started building a solidworks addin, got reasonable success with c# using the template. However when I tried to create one with C++, using just the files from the template wizard, I've encountered an error "Unable to start program ____.dll" when I tried to run it in debug.

       

      Additional information that may be useful, I've tried this in both visual studio 2010 and 2012, same error.

      The add in compiles file and can be added into solidworks, just that i am unable to press 'start' and run solidwork + addin in visual studio's debugger.

      This is for a 64 bit system.

       

      unable to start.PNG

       

      Many thanks.

        • Re: C++ Addin Unable To Start Program
          Artem Taturevych

          You cannot start the dll - this is a library not executable. You need to attach to SolidWorks process to debug your dll (just like in .NET). Make sure your project is setup to run SLDWORKS.exe as the debug process.

            • Re: C++ Addin Unable To Start Program
              Yuan M

              I used the Debug > attach process, but my debug points don't seem to be hit.

                • Re: C++ Addin Unable To Start Program
                  Artem Taturevych

                  Does your project configuration generate the debug info (PDB file)? Do you have a '_DEBUG' preprocessor variable declared? Can you attach your project?

                    • Re: C++ Addin Unable To Start Program
                      Yuan M

                      I'm building and running debug mode x64 so it has the _DEBUG preprocessor from visual studio. I'm not sure about the PDB file part. I believe I am not setting up the project correctly and couldn't get the code to build anymore. Would you be able to point me to some link with project set up steps? Thanks for your patience.

                       

                      The steps that I've taken were

                       

                      1. New Project > VC++ > SolidWorks COM Non attributed addin

                      2. project > properties > C/C++ > Additional Include Directories > "C:\Program Files\SolidWorks Corp\SolidWorks"

                      3. -------------------- > Debugging > Command > "C:\Program Files\SolidWorks Corp\SolidWorks\SLDWORKS.exe"

                      4. ---------------------------------------- > Attach > Yes

                       

                      But this gave a build error of 'openModelViews' : undeclared identifier

                       

                      I think I got it to build previously by adding solidworks directory to project > properties > VC++ directories > library etc directory. But that's no longer seem to work. I've attached my current project which was set up using steps 1-4 above.