Jasdeep Singh Arora
Jasdeep Singh Arora

Reputation: 573

How to Build Cpp code on jenkins?

I am executing a batch file in Jenkins for building a cpp code and i have a command in between to build the executable like "g++ sourcefile.cpp -o executablefile" and it gives error 'g++' is not recognized as an internal or external command.How to Resolve this??

Upvotes: 2

Views: 8477

Answers (2)

jwernerny
jwernerny

Reputation: 7048

When Jenkins is run as a service on a Windows machine it runs under the System account, not a user account (or your account). Therefore, you need to make sure that everything you need to setup for paths (etc.) is either done for the system account or included as part of your "Windows Batch Script" in Jenkins. (I actually use this method myself for several projects.)

To test if the System Account can do the compile, you need to open a CMD prompt as the System Account. This question should help you with taht: How Do You Run CMD under System Account.

Upvotes: 2

Aniket Inge
Aniket Inge

Reputation: 25723

  1. Install GCC and bintools
  2. Set the environment variable: PATH of your system to the folder that contains gcc.exe, g++.exe
  3. done!

Upvotes: 1

Related Questions