Panel użytkownika
Nazwa użytkownika:
Hasło:
Nie masz jeszcze konta?

[Qt, C++]Program do kompilowania w G++ - nie tworzy pliku *.o

Ostatnio zmodyfikowano 2010-09-12 20:24
Autor Wiadomość
lenrokskate
Temat założony przez niniejszego użytkownika
[Qt, C++]Program do kompilowania w G++ - nie tworzy pliku *.o
» 2010-09-11 11:21:52
Wrzucam paczkę z projektem Qt Creatora, żeby nie pisać miliona postów: http://www.sendspace.pl/file/72c7116e961e5740e00a610

No więc jest to program, któy ma ułatwić kompilację pojedyńczych plików C/CPP. Screen:

screen z programu
screen z programu


Narazie stanąłem na problemie z tworzeniem pliku object. Wykonuję polecenie (poprzez system() - tak, tak wiem, tak się nie robi, ale to później):
<ścieżka do g++> -c -l <ścieżka do pliku cpp> <folder z headerami>

Po wykonaniu tego polecenia ani w folderze z kompilatorem (biorę go z Code Blocks), ani w folderze z plikiem cpp nie tworzy się plik *.o. Wie ktoś może dlaczego?

#aha i jescze jedno, plik który kompiluję to nie ten na screenie, tylko taki:
C/C++
#include <iostream>
#include <conio.h>

using namespace std;

int main()
{
    cout << "hello world";
    getch();
}
P-21895
DejaVu
» 2010-09-11 11:35:30
Ustaw working directory, czyli katalog roboczy. Zapewne w nim pojawia się plik *.o jeżeli kompilacja w ogóle działa.
P-21897
lenrokskate
Temat założony przez niniejszego użytkownika
» 2010-09-11 11:40:36
jak mam to zrobić? w tutorialach które znalazłem na necie nic o tym nie pisze...
P-21899
DejaVu
» 2010-09-11 11:43:56
Katalogiem roboczym jest zazwyczaj katalog w którym znajdujesz się w chwili uruchomienia programu. Katalog roboczy można przestawić (w przypadku Windowsa) tworząc skrót do niego, a następnie prawy klawisz/Właściwości oraz należy ustawić "Rozpocznij w".

/edit:
Zaraz, zaraz... a plik EXE się pojawił? Może po prostu ten program ma katalog tymczasowy do plików *.o żeby śmieci nie zostawiać?
P-21900
lenrokskate
Temat założony przez niniejszego użytkownika
» 2010-09-11 11:47:47
nie działa - zrobiłem skrót na pulpit, wd zmieniłem na "E:\", włączyłem kompilację ale na dysku E: nie ma pliku *.o

#edit: nie, plik exe się nie pojawił, bo jeszcze nie zrobiłem linkowania... narazie sama kompilacja
P-21901
DejaVu
» 2010-09-11 11:49:47
Spróbuj więc najpierw skompilować z wiersza poleceń, a potem będziesz cudował za pomocą programu. Łatwiej będzie zdiagnozować problem.
P-21902
lenrokskate
Temat założony przez niniejszego użytkownika
» 2010-09-11 12:16:39
odpalam z cmd     <sciezka> (copy->paste) <-c> <E:main.cpp>   i nic... plik cpp znajduje się na swoim miejscu ale nigdzie nie ma pliku .o (w folderze z kompilatorem też)

#edit - kombinowałem trochę i jest takie coś (nadal brak pliku):
http://img137.imageshack.us/img137/6717/beztytuumt.png
P-21903
DejaVu
» 2010-09-11 12:52:38
No tak, nie tworzy pliku *.o bowiem tworzy plik *.exe. To nie biblioteka aby tworzyło plik *.o.

/edit:
X:\sialala>mingw32-g++ --help
Usage: mingw32-g++ [options] file...
Options:
  -pass-exit-codes         Exit with highest error code from a phase
  --help                   Display this information
  --target-help            Display target specific command line options
  --help={target|optimizers|warnings|params|[^]{joined|separate|undocumented}}[,
...]
                           Display specific types of command line options
  (Use '-v --help' to display command line options of sub-processes)
  --version                Display compiler version information
  -dumpspecs               Display all of the built in spec strings
  -dumpversion             Display the version of the compiler
  -dumpmachine             Display the compiler's target processor
  -print-search-dirs       Display the directories in the compiler's search path

  -print-libgcc-file-name  Display the name of the compiler's companion library
  -print-file-name=<lib>   Display the full path to library <lib>
  -print-prog-name=<prog>  Display the full path to compiler component <prog>
  -print-multi-directory   Display the root directory for versions of libgcc
  -print-multi-lib         Display the mapping between command line options and
                           multiple library search directories
  -print-multi-os-directory Display the relative path to OS libraries
  -print-sysroot           Display the target libraries directory
  -print-sysroot-headers-suffix Display the sysroot suffix used to find headers
  -Wa,<options>            Pass comma-separated <options> on to the assembler
  -Wp,<options>            Pass comma-separated <options> on to the preprocessor

  -Wl,<options>            Pass comma-separated <options> on to the linker
  -Xassembler <arg>        Pass <arg> on to the assembler
  -Xpreprocessor <arg>     Pass <arg> on to the preprocessor
  -Xlinker <arg>           Pass <arg> on to the linker
  -combine                 Pass multiple source files to compiler at once
  -save-temps              Do not delete intermediate files
  -pipe                    Use pipes rather than intermediate files
  -time                    Time the execution of each subprocess
  -specs=<file>            Override built-in specs with the contents of <file>
  -std=<standard>          Assume that the input sources are for <standard>
  --sysroot=<directory>    Use <directory> as the root directory for headers
                           and libraries
  -B <directory>           Add <directory> to the compiler's search paths
  -b <machine>             Run gcc for target <machine>, if installed
  -V <version>             Run gcc version number <version>, if installed
  -v                       Display the programs invoked by the compiler
  -###                     Like -v but options quoted and commands not executed
  -E                       Preprocess only; do not compile, assemble or link
  -S                       Compile only; do not assemble or link
  -c                       Compile and assemble, but do not link
  -o <file>                Place the output into <file>
  -x <language>            Specify the language of the following input files
                           Permissible languages include: c c++ assembler none
                           'none' means revert to the default behavior of
                           guessing the language based on the file's extension

Options starting with -g, -f, -m, -O, -W, or --param are automatically
 passed on to the various sub-processes invoked by mingw32-g++.  In order to pas
s
 other options on to these processes the -W<letter> options must be used.

For bug reporting instructions, please see:
<http://www.tdragon.net/recentgcc/bugs.php>.

/edit2:
mingw32-g++ sample.cpp -c
Powyższy wiersz generuje plik *.o.
P-21904
« 1 » 2
  Strona 1 z 2 Następna strona