Почему мне нужен *.obj файл при статичном соединении?

когда вы используете функцию do_upload (), ее имя переименовывается, если оно уже существует, и загружает файл

System-> library-> Upload.php

функция по умолчанию для do_upload () возвращает true или false replace

return $ this-> upload_path. $ this-> file_name;

и в другом файле

 <input type='file' name='userfile'/>


<?php
    $upload_file_name = $this->upload->do_upload('userfile');
                $finalname;
                if (!$upload_file_name) {
                    $finalname = 'default.png';
                } else {

                    $split_data_upload_file_name = explode("/", $upload_file_name);
                    foreach ($split_data_upload_file_name as $i => $value) {

                        $finalname = $value;
                    }
                }

?>
5
задан Esteban Küber 31 July 2009 в 14:38
поделиться

3 ответа

Я считаю, что ваша строка компоновщика неверна. Библиотека должна иметь суффикс .lib . Итак, nsglCore должно быть nsglCore-Win32-Release.lib или, может быть, nsglCore - $ (TargetPlatform) - $ (ConfigurationName) .lib или любым другим правильным расширением макроса есть.

5
ответ дан 13 December 2019 в 05:41
поделиться

Ах ... Visual Studio слишком умна для вас

Перейдите к проектам, которые включают библиотеку, щелкните правой кнопкой мыши для свойств

Перейти к свойствам конфигурации | Компоновщик

Внизу: Use Library Dependancy Inputs - Set to No

Это опция Visual Studio для прямого захвата файлов .obj, а не файла .lib. Я полагаю, что это делается для того, чтобы избежать этапа связывания и, таким образом, ускорить компиляцию.

В общем, вы должны установить проект, который создает файл lib как зависимость от проекта, который его использует (в общих свойствах в этом окне свойств) . Затем вы включаете зависимости библиотеки ссылок. Это хорошо работает в большинстве случаев.

3
ответ дан 13 December 2019 в 05:41
поделиться

Generally, static libs do not generate object files. What you do is create object files and place them in a library, then the linker will search for the object files in those libraries.

I'll explain from a UNIXy command line point of view since that's the simpler to understande (I have no idea what machinations VS does before doing the basic stuff).

A sample command line for creating an executable is:

gcc -c -o prog.o prog.c
gcc -o prog prog.o -L/libdir -lstdc

The first line simply creates an object file from your C file. The second line creates the executable by pulling object files together, generally following a rule set like:

  • All .o file listed explicitly are linked.
  • Once that's done, you search the libraries for other objects which satisfy referenced-but-undefined symbols.

For example, say your prog.c contained the line printf("hello\n");. That will have resulted in your prog.o file containing a reference to printf that is not yet satisfied.

The linker will search your specified libraries until it satisfies that reference. In this case it will search all files of the form /libdir/libstdc.ext where:

  • /libdir is from your -L option (a path to search for libraries in).
  • /lib is a constant.
  • stdc is the name of a library to search (from -l).
  • ext is one or more extensions (.a, .so, .sl, etc).

Once the symbol is found, that object file is linked in to resolve it. This may result in more unsatisfied symbols appearing such as /libdir/libstdc.a(printf.o) having a reference to /libdir/libstdc.a(putch.o).

Your particular problem may be caused by the fact that you're trying to link the object file directly rather than searching the libraries. VS should have project options to specify object files, library search paths and library names (I'm not sure of this for the latest versions but I know earlier versions of MSVC did).

4
ответ дан 13 December 2019 в 05:41
поделиться
Другие вопросы по тегам:

Похожие вопросы: