From 43a4ae73fca69587537662e35248c3eb883d0f83 Mon Sep 17 00:00:00 2001 From: Max Smolens Date: Fri, 11 Sep 2015 10:06:45 -0400 Subject: [PATCH 1/2] fix: Resolve link error in PythonQtTestMain on Windows This changes the type of the `argv` parameter in the `main` function to match the expected signature for integration with the CMake testing framework. By default, the test driver expects the main function to have the following signature: ``` typedef int (*MainFuncPointer)(int, char* []); ``` See https://github.com/Kitware/CMake/blob/master/Templates/TestDriver.cxx.in This fixes a link error when building PythonQtCppTests on Windows: ``` 1>PythonQtCppTests.obj : error LNK2001: unresolved external symbol "int __cdecl tests_PythonQtTestMain(int,char * * const)" (?tests_PythonQtTestMain@@YAHHQEAPEAD@Z) 1>C:\temp\PythonQt-build\Debug\PythonQtCppTests.exe : fatal error LNK1120: 1 unresolved externals ``` (cherry picked from commit commontk/PythonQt@aa1a16fc0d3fd9eec662bb76a4a1e0fb4f61d47d) --- tests/PythonQtTestMain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/PythonQtTestMain.cpp b/tests/PythonQtTestMain.cpp index f8e82c833..8b6dd82fe 100644 --- a/tests/PythonQtTestMain.cpp +++ b/tests/PythonQtTestMain.cpp @@ -45,7 +45,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); From c4156dc66cbfe70be8cfd42b06ac0fbc3bdb30f8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Fillion-Robin Date: Thu, 4 Sep 2025 18:14:02 -0400 Subject: [PATCH 2/2] fix: Update main function signature used in examples This change ensures that the main function signatures in all example files are consistent. --- examples/PyCPPWrapperExample/main.cpp | 2 +- examples/PyCustomMetaTypeExample/main.cpp | 2 +- examples/PyDecoratorsExample/main.cpp | 2 +- examples/PyGettingStarted/main.cpp | 2 +- examples/PyGuiExample/main.cpp | 2 +- examples/PyLauncher/main.cpp | 2 +- examples/PyScriptingConsole/main.cpp | 2 +- src/PythonQtDoc.h | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/PyCPPWrapperExample/main.cpp b/examples/PyCPPWrapperExample/main.cpp index 8938f4c7d..064f0dc7b 100644 --- a/examples/PyCPPWrapperExample/main.cpp +++ b/examples/PyCPPWrapperExample/main.cpp @@ -45,7 +45,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyCustomMetaTypeExample/main.cpp b/examples/PyCustomMetaTypeExample/main.cpp index 4a2ec3fe3..28813e31f 100644 --- a/examples/PyCustomMetaTypeExample/main.cpp +++ b/examples/PyCustomMetaTypeExample/main.cpp @@ -45,7 +45,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyDecoratorsExample/main.cpp b/examples/PyDecoratorsExample/main.cpp index 3fe5d6d54..336963653 100644 --- a/examples/PyDecoratorsExample/main.cpp +++ b/examples/PyDecoratorsExample/main.cpp @@ -45,7 +45,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyGettingStarted/main.cpp b/examples/PyGettingStarted/main.cpp index 0d264ccd9..dcc52ccea 100644 --- a/examples/PyGettingStarted/main.cpp +++ b/examples/PyGettingStarted/main.cpp @@ -47,7 +47,7 @@ #include #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyGuiExample/main.cpp b/examples/PyGuiExample/main.cpp index 901aeee40..633f51f59 100644 --- a/examples/PyGuiExample/main.cpp +++ b/examples/PyGuiExample/main.cpp @@ -50,7 +50,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyLauncher/main.cpp b/examples/PyLauncher/main.cpp index c4db944f4..d0d3c6b9f 100644 --- a/examples/PyLauncher/main.cpp +++ b/examples/PyLauncher/main.cpp @@ -48,7 +48,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/examples/PyScriptingConsole/main.cpp b/examples/PyScriptingConsole/main.cpp index 5649fa13c..f094a6cc3 100644 --- a/examples/PyScriptingConsole/main.cpp +++ b/examples/PyScriptingConsole/main.cpp @@ -52,7 +52,7 @@ #include -int main( int argc, char **argv ) +int main(int argc, char *argv[]) { QApplication qapp(argc, argv); diff --git a/src/PythonQtDoc.h b/src/PythonQtDoc.h index e53b9e901..8f2609725 100644 --- a/src/PythonQtDoc.h +++ b/src/PythonQtDoc.h @@ -572,7 +572,7 @@ the python2x.[lib | dll | so | dynlib]. #include ... - int main( int argc, char **argv ) + int main(int argc, char *argv[]) { QApplication qapp(argc, argv);