How I can configure QT Project using Qt 5.12.1/Qt Creator 4.8.1
I need compile my project for mac os.
I tryed with QT Creator, then, below problem occur.
Or compile with below command.
qmake
make
But, below error is occur.
third_party/wfdbio.cpp:181:5: fatal error: assigning to 'char *' from
incompatible type 'void *'
SSTRCPY(wfdbpath, wfdbpath_init);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/wfdb.h:234:3: note: expanded from macro 'SSTRCPY'
SALLOC(P, (size_t)strlen(WFDB_tmp)+1,1); strcpy(P, WFDB_tmp); } }
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
third_party/wfdb.h:231:37: note: expanded from macro 'SALLOC'
#define SALLOC(P, N, S) { SFREE(P); SUALLOC(P, (N), (S)) }
^~~~~~~~~~~~~~~~~~~~
third_party/wfdb.h:230:38: note: expanded from macro 'SUALLOC'
#define SUALLOC(P, N, S) { if (!(P = calloc((N), (S)))) MEMERR(P, (N), (S)); }
^~~~~~~~~~~~~~~~
1 error generated.
make: *** [objects/wfdbio.o] Error 1
Of course, I can change some code with typecast, ex.)
char* to void*
.
But, there are many macros, and codes, so, many code change is need for "remove type cast".
Of course, I used "-fpermissive" flags, and my project is compiled at Windows 10.
So, How I can compile my project without code change?
EDIT:
Here is a MRE of my problem:
#include <stdio.h>
#include <stdlib.h>
int main()
{
char *buffer;
printf("How long do you want the string? ");
buffer = malloc(10);
// buffer = (char* ) malloc(10);
return 0;
}
This code is compiled at Windows10 Cygwin.
# At Cygwin, gcc version is
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-cygwin/7.4.0/lto-wrapper.exe
Target: x86_64-pc-cygwin
Configured with: /cygdrive/i/szsz/tmpp/gcc/gcc-7.4.0-1.x86_64/src/gcc-7.4.0/configure --srcdir=/cygdrive/i/szsz/tmpp/gcc/gcc-7.4.0-1.x86_64/src/gcc-7.4.0 --prefix=/usr --exec-prefix=/usr --localstatedir=/var --sysconfdir=/etc --docdir=/usr/share/doc/gcc --htmldir=/usr/share/doc/gcc/html -C --build=x86_64-pc-cygwin --host=x86_64-pc-cygwin --target=x86_64-pc-cygwin --without-libiconv-prefix --without-libintl-prefix --libexecdir=/usr/lib --enable-shared --enable-shared-libgcc --enable-static --enable-version-specific-runtime-libs --enable-bootstrap --enable-__cxa_atexit --with-dwarf2 --with-tune=generic --enable-languages=ada,c,c++,fortran,lto,objc,obj-c++ --enable-graphite --enable-threads=posix --enable-libatomic --enable-libcilkrts --enable-libgomp --enable-libitm --enable-libquadmath --enable-libquadmath-support --disable-libssp --enable-libada --disable-symvers --with-gnu-ld --with-gnu-as --with-cloog-include=/usr/include/cloog-isl --without-libiconv-prefix --without-libintl-prefix --with-system-zlib --enable-linker-build-id --with-default-libstdcxx-abi=gcc4-compatible --enable-libstdcxx-filesystem-ts
Thread model: posix
gcc version 7.4.0 (GCC)
But, I cannot compile at My Mac OS.
Below is error code.
Ws-Mac:Desktop w$ gcc test.cpp -fpermissive
test.cpp:9:14: error: assigning to 'char *' from incompatible type 'void *'
buffer = malloc(10);
^~~~~~~~~~
1 error generated.
# At Mac OS, gcc version is
Ws-Mac:Desktop w$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
Ws-Mac:Desktop w$