开发者

Using Cygwin to build - Template with C Linkage

开发者 https://www.devze.com 2023-01-24 01:11 出处:网络
Im trying to build some of my plugins for Linux using Cygwin (keep screwing up Linux virtual machines so I decided to try setting up Cygwin since I wouldn\'t have to move all my SDKs and what not). Ev

Im trying to build some of my plugins for Linux using Cygwin (keep screwing up Linux virtual machines so I decided to try setting up Cygwin since I wouldn't have to move all my SDKs and what not). Everything seemed okay except I got the error "gcc: error trying to exec 'cc1plus': No such file or directory" so I installed g++4.3 on top of gcc 4.3. Once I did that I am getting tons of errors now. The main ones that are being spammed are...

error: Template with C Linkage error: Template with specialization with C Linkage

These are being spammed on files from the SDK that thousands of other people use to compile, so I know it isn't a 'dangling c extern' but I am assuming I am missing a package or something. In Ubuntu, installing build-essential fixes any of these problems, but I am at a loss with Cygwin. Any help would be much appreciated.

Edit

Here is an ampaste of the exact errors it is spewing http://www.ampaste.net/m3d0a864f

The first one from Sourcehook.h is because linux is apparently not defined in Cygwin, 开发者_如何学Cbut the rest from the 'hl2sdk' have me at a loss.


I know you said there's no dangling extern "C"... But why would that even be an issue given how you are compiling with gcc and not g++??? (Which will, in fact, happily treat smsdk_ext.cpp as a C and NOT C++ file... With all the errors and pain that come from doing so...)


Often you will see such error messages when the wrong include files are tagged extern "C". (Or not properly tagged as the case may be.)

Your error messages also indicate difficulty overloading functions...

platform.h: In function ‘double fsel(double, double, double)’:
platform.h:470: error: declaration of C function 'double fsel(double, double, double)'
conflicts with
platform.h:466: error: previous declaration 'float fsel(float, float, float)'

And problems with system (compiler) files.

In file included from /usr/include/sys/signal.h:104,
            from /usr/include/signal.h:5,
            from /usr/include/pthread.h:15,
            from /cygdrive/...
/usr/include/cygwin/signal.h:74: error: expected ‘;’ before ‘*’ token
/usr/include/cygwin/signal.h:97: error: ‘uid_t’ does not name a type

In file included from /usr/include/signal.h:5,
            from /usr/include/pthread.h:15,
            from /cygdrive/...
/usr/include/sys/signal.h:163: error: ‘pthread_t’ was not declared in this scope
/usr/include/sys/signal.h:163: error: expected primary-expression before ‘int’
/usr/include/sys/signal.h:163: error: initializer expression list treated as compound expression

So either your compiler installation is really munged OR...


Alternatively, another approach is to start with a minimal Hello World program and see if that compiles. Then build up, including what you need to, until you hit a problem. (Or take the existing software and simplify it down until you find the problem area. Start with one "g++" line, copy the file, and pare it down until the problem goes away. Perhaps you have a #define or typedef that conflicts with something in a system file.)


@Mr. Ree: "C ++ source files conventionally use one of the suffixes .C, .cc, .cpp, .CPP, .c++, .cp, or .cxx; C ++ header files often use .hh, .hpp, .H, or (for shared template code) .tcc; and preprocessed C ++ files use the suffix .ii. GCC recognizes files with these names and compiles them as C ++ programs even if you call the compiler the same way as for compiling C programs (usually with the name gcc)." GCC stands for the GNU Compiler Collection for quite some time now. http://linux.die.net/man/1/gcc

0

精彩评论

暂无评论...
验证码 换一张
取 消