最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c - gcc: error: unrecognized command-line option '-framework' Error - Stack Overflow

programmeradmin2浏览0评论

I'm currently trying to compile a Verlet Integration simulation on my Windows 11 machine, but I get the following error:

gcc -Wall -std=c99 -O2 -o app src/app.o src/camera.o src/graphics.o src/kdtree.o src/mathc.o src/model.o src/peripheral.o src/shader.o src/util.o src/verlet.o -L src/dependencies/library -lpthread -lglfw -lGLEW -framework Cocoa -framework OpenGL -framework IOKit
gcc: error: unrecognized command-line option '-framework'
gcc: error: unrecognized command-line option '-framework'
gcc: error: unrecognized command-line option '-framework'
make: *** [Makefile:22: app] Error 1```

I'm aware that a similar issue has been raised here before, but my problem with the solutions provided is that they are UNIX-specific.

I stand to be corrected but I believe the following line in the MakeFile is OSX specific:

LDFLAGS = -lpthread -lglfw -lGLEW -framework Cocoa -framework OpenGL -framework IOKit

That's what's causing the problem. How do I make this work on Windows?

I'm currently trying to compile a Verlet Integration simulation on my Windows 11 machine, but I get the following error:

gcc -Wall -std=c99 -O2 -o app src/app.o src/camera.o src/graphics.o src/kdtree.o src/mathc.o src/model.o src/peripheral.o src/shader.o src/util.o src/verlet.o -L src/dependencies/library -lpthread -lglfw -lGLEW -framework Cocoa -framework OpenGL -framework IOKit
gcc: error: unrecognized command-line option '-framework'
gcc: error: unrecognized command-line option '-framework'
gcc: error: unrecognized command-line option '-framework'
make: *** [Makefile:22: app] Error 1```

I'm aware that a similar issue has been raised here before, but my problem with the solutions provided is that they are UNIX-specific.

I stand to be corrected but I believe the following line in the MakeFile is OSX specific:

LDFLAGS = -lpthread -lglfw -lGLEW -framework Cocoa -framework OpenGL -framework IOKit

That's what's causing the problem. How do I make this work on Windows?

Share Improve this question asked 2 days ago Lebogang MasiaLebogang Masia 11 New contributor Lebogang Masia is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 1
  • 1 If the code you are trying to build is specifically targeted at one operating system then you will need to convert the sources to run on a different OS. So you need to look at the actual sources that make up the project to see what needs to be changed. It may be simply a matter of some preprocessor definitions, or it may be a major conversion effort. – OldBoy Commented 2 days ago
Add a comment  | 

1 Answer 1

Reset to default -2

This appears to be a Darwin-specific option for GCC.

These options are defined for all architectures running the Darwin operating system.

Assuming you're on an Apple device or something running Darwin OS, the Darwin-Options section of the GCC documentation indicates a different format for using the framework option:

-Fdir

Add the framework directory dir to the head of the list of directories to be searched for header files. These directories are interleaved with those specified by -I options and are scanned in a left-to-right order.

A framework directory is a directory with frameworks in it. A framework is a directory with a Headers and/or PrivateHeaders directory contained directly in it that ends in .framework. The name of a framework is the name of this directory excluding the .framework. Headers associated with the framework are found in one of those two directories, with Headers being searched first. A subframework is a framework directory that is in a framework’s Frameworks directory. Includes of subframework headers can only appear in a header of a framework that contains the subframework, or in a sibling subframework header. Two subframeworks are siblings if they occur in the same framework. A subframework should not have the same name as a framework; a warning is issued if this is violated. Currently a subframework cannot have subframeworks; in the future, the mechanism may be extended to support this. The standard frameworks can be found in /System/Library/Frameworks and /Library/Frameworks. An example include looks like #include <Framework/header.h>, where Framework denotes the name of the framework and header.h is found in the PrivateHeaders or Headers directory.

-iframeworkdir

Like -F except the directory is a treated as a system directory. The main difference between this -iframework and -F is that with -iframework the compiler does not warn about constructs contained within header files found via dir. This option is valid only for the C family of languages.

Your code base may come from a different version of GCC and the option may have evolved. You can either adapt your code or downgrade your gcc version. For more details, see GCC options.

Hope this helps

发布评论

评论列表(0)

  1. 暂无评论