Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7661543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:36:44+00:00 2026-05-31T13:36:44+00:00

I am using CreateProcess to invoke cl and link to compile and link another

  • 0

I am using CreateProcess to invoke cl and link to compile and link another C++ program (TestProg.cxx) into a DLL. I found the correct compilation and linkage options:

Compilation Options:

/W3 /WX- /Od /Oy- /D WIN32 /D _DEBUG /D _WINDOWS /D _USRDLL /D BUILDDLL_EXPORTS /D _WINDLL /D _UNICODE /D UNICODE /GS /fp:precise /Zc:wchar_t /Zc:forScope /Gd /analyze- /errorReport:queue /LD 

Linkage Options:

/INCREMENTAL /NOLOGO "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /ERRORREPORT:QUEUE /Entry:DllMain 

I call CreateProcess with:

if ( CreateProcess(full path to cl.exe, compilation options, NULL,NULL,FALSE,0,       NULL,NULL,&si,&pi) ) 
{
 //....
}

Running the application from VS tools prompt, it works and the dll is created.

But running it from the VS debugger I get the following LINK error:

LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

or when the link libs are removed from the link options I get the following error:

LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'

What am I doing wrong?

IMO it seems something is missing in the link options to run in debug mode, or the search path of debug mode lacks some directories. I don’t know how to fix any of these cases.
I googled this for the last 1/2 day, but didn’t find it. Using windows API is new to me.

Many thanks in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T13:36:45+00:00Added an answer on May 31, 2026 at 1:36 pm

    Sounds like you’re missing the environment variables which you get when running from the VS command line.
    Part of this is also the library search path.

    See C:\Program Files\Microsoft Visual Studio XX\Common7\vsvars32.bat (depending on your VS version and installation path, which is specified in the VS100COMNTOOLS (or VS90COMNTOOLS, or which ever) environment variable.

    Why are you doing this anyway? You could be using MSBuild to configure a project and build it. You can call MSBuild from your code, while the project is already configured for you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CreateProcess to invoke cl to compile and link another C++ program
I am trying to create a program that calls another process using CreateProcess. After
I'm using PyWin32's win32process.CreateProcess to start up a GUI program that has functionality I
My Windows XP/7 program launches a child process using the Windows API CreateProcess() function
I am using CreateProcess function for creating the process, is there any option to
I'm using the Win32 CreateProcess function to perform a call to an external executable.
I'm spawning a process from Win32 using CreateProcess , setting the hStdOutput and hStdError
I have written a program a.exe which launches another program I wrote, b.exe ,
I am using jdj 1.7,netbeans 7 versions. I wrote a program that's working fine.
I'm using CreateProcess() with startup flags set to STARTF_USESHOWWINDOW and SW_HIDE to start an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.