0
In case you use a build system (CMake, SCons, ...) it is highly possible that the build system is also generating some files, and one of them might be containing the main()
method. We use this methodology when we generate the main function in order to instantiate classes for libraries that were specifically selected in CMake-gui.
如果您使用构建系统(CMake,SCons,...),构建系统很可能也生成一些文件,其中一个可能包含main()方法。当我们生成main函数时,我们使用这种方法来实例化在CMake-gui中专门选择的库的类。
And again, it is possible that the build system deletes the generated files due to some obscure policy the original developers thought of but didn't tell you. So search through your build system files, see what is actually happening there.
同样,构建系统可能会删除生成的文件,因为原始开发人员想到的一些模糊的策略却没有告诉你。因此,搜索构建系统文件,查看实际发生的情况。
Edit
So, after seeing you CMakeLists.txt:
所以,在看到你CMakeLists.txt之后:
check ${DIR_EXT}/covis/src/ci.cpp
where DIR_EXT
is SET( DIR_EXT "../ext/" CACHE PATH "Folder holding external libraries" )
检查$ {DIR_EXT} /covis/src/ci.cpp其中DIR_EXT是SET(DIR_EXT“../ext/”CACHE PATH“文件夹持有外部库”)
See what's in there and let us know :)
看看那里有什么,让我们知道:)
Edit2
After seeing build.sh
(execute steps in order):
看到build.sh后(按顺序执行步骤):
1. change
`cmake -D COMPILE_BINARY=ON ..`
to
`cmake -D COMPILE_BINARY=ON -DCMAKE_BUILD_TYPE=Debug ..`
and add the same -DCMAKE_BUILD_TYPE=Debug
to the other cmake
command too.
并将相同的-DCMAKE_BUILD_TYPE = Debug添加到另一个cmake命令中。
This will build your library and executable in debug mode.
这将在调试模式下构建您的库和可执行文件。
2. Now, in one of the c++ source files you have access to and you are sure will be called (the earlier the function will be calle the better), add:
2.现在,在您可以访问的一个c ++源文件中,您确定将被调用(函数越早越好),添加:
asm("int $0x03");
This will create a breakpoint in your application.
这将在您的应用程序中创建一个断点。
(If you do not want to use this, see below).
(如果您不想使用此功能,请参阅下文)。
3. Build your application.
3.构建您的应用程序。
4. Run it via a debugger in terminal:
4.通过终端中的调试器运行它:
gdb ./myapplication
(this will give you a gdb prompt)
(这会给你一个gdb提示)
(if you did not add the asm
breakpoint from above, type in the gdb prompt: break filename.cpp:linenumber
or break methodname
to add a gdb breakpoint).
(如果你没有从上面添加asm断点,请输入gdb提示符:break filename.cpp:linenumber或break methodname以添加gdb断点)。
run
Now your application should stop in your function when it is executed. You are still in the gdb prompt, so type:
现在,您的应用程序应在执行时停止在您的函数中。您仍然在gdb提示符中,因此键入:
bt
This will print out the backtrace of your application. Somewhere you should see a main function, together with filename and linenumber.
这将打印出您的应用程序的回溯。在某个地方,您应该看到一个主要功能,以及文件名和亚麻布。
However, that setnames.sh
looks interesting, see if it does not do anything funny :)
但是,setnames.sh看起来很有趣,看看它是不是做了什么搞笑:)