C ++从Visual Studio编译源文件

时间:2016-02-22 18:05:15

标签: c++ visual-studio cl

我需要从Visual Studio编译外部源文件。 我从开发人员命令提示符中选择了它:

    <?php 
     if (!isset($_POST["username"]))


     {

     header('Location: login.html');
       }
      if (!isset($_POST["password"]))
      {

      header('Location: login.php');
      }

     else
       {
    session_start();    
    $username = $_POST["username"];
    $password = $_POST["password"];
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    include ("db_connect.php"); 
    $select = "SELECT * from login and studentlogin where username = '$username' and password = '$password'";

      $rows = mysql_query("$select");

    if (mysql_num_rows($rows)<1){

            mysql_close($con);

    header("location: http://localhost/Mywebsite/wrong.html");

       }
    else
       { 


        while($query = mysql_fetch_array($rows)) {

            $adm = $query['username'];


           $check = substr($adm, 0, 3);
             if ($check == 'adm')
                {

所以我尝试了这个:

cl /EHsc test.cpp

但命令'cl'不存在于system()

调用的普通cmd中

有关如何使用编译器功能的任何建议吗?

1 个答案:

答案 0 :(得分:0)

现在我自己做了,对于那些好奇的人我通过制作vcvars32.bat的副本并添加了一些这样的命令来做到这一点:

cd %~dp0%

cl /LD source.cpp /EHsc ;remember putting this part after the bat-file called all important commands

现在我只需要从c ++执行这个文件,我们就这么做了。