Ir para conteúdo
Fórum Script Brasil
  • 0

Como Compilar Sources Em .exe ?


ppgsalomao

Pergunta

1 resposta a esta questão

Posts Recomendados

  • 0

Então,

Sou novo em C++, to tentando aprender, então vou fazer perguntas idiotas por algum tempo aqui!

Mas enfim,

Estou com o Dev C++ aqui em casa, digitei lá o código bunitinho de um "somador" ... cliquei em Execute>Compile ... mas ele cria um arquivo *.o ! o que eu faço pra esse arquivo virar executável ?

Salve,

você acha o tuto completo em http://www.geocities.com/uniqueness_template/

mas aqui esta o trecho de compilação.

sds

Step 4: Compile.

Once you have entered all of your source code, you are ready to compile.

• Go to the "Execute" menu and select "Compile" (or just press CTRL+F9).

It is likely that you will get some kind of compiler or linker error the first time you attempt to compile a project. Syntax errors will be displayed in the "Compiler" tab at the bottom of the screen. You can double-click on any error to take you to the place in the source code where it occurred. The "Linker" tab will flash if there are any linker errors. Linker errors are generally the result of syntax errors not allowing one of the files to compile.

Step 5: Execute.

Once your project successfully compiles, you will get a dialog box with several options:

• "Continue", which will just take you back to Dev-C++.

• "Parameters", which will allow you to pass command-line parameters to your program.

• "Execute", which will execute your program.

Disappearing windows

If you execute your program (with or without parameters), you may notice something peculiar; a console window will pop up, flash some text and disappear. The problem is that, if directly executed, console program windows close after the program exits.

You can solve this problem one of two ways:

• Method 1 - Scaffolding:

Add the following code before any return statement in main() or any exit() or abort() statement (in any function):

/* Scaffolding code for testing purposes */

cin.ignore(256, '\n');

cout << "Press ENTER to continue..." << endl;

cin.get();

/* End Scaffolding */

This will give you a chance to view any output before the program terminates and the window closes.

• Method 2 - Command-prompt:

Alternatively, instead of using Dev-C++ to invoke your program, you can just open an MS-DOS Prompt, go to the directory where your program was compiled (i.e. where you saved the project) and enter the program name (along with any parameters). The command-prompt window will not close when the program terminates.

For what it's worth, I use the command-line method.

Link para o comentário
Compartilhar em outros sites

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...