linkage

ReferenceError: Error #1008 Class is ambiguous

时光毁灭记忆、已成空白 提交于 2020-01-05 13:06:10
问题 I have a As3 file and I get a runtime error: ReferenceError: **Error #1008**: Tooltip is ambiguous; Found more than one matching binding. I have a class named Tooltip and also a symbol in library with linkage class: Tooltip and Base Class fvg.Tooltip (fvg is the name of the package). Why I get this conflict? 回答1: Fixed! I had to import the Tooltip class in my Document class file. 来源: https://stackoverflow.com/questions/2446183/referenceerror-error-1008-class-is-ambiguous

OpenGL libraries linkage on linux

百般思念 提交于 2020-01-05 12:09:10
问题 I coded a small OpenGL program displaying a simple quad. To do the job done, I linked -lglut in my Makefile. Until here all is ok. Here's my Makefile content : NAME = Quad CXX = g++ SRCS = main.cpp OBJS = $(SRCS:.cpp=.o) CXXFLAGS += -W -Werror -Wextra LIBX += -lglut RM = rm -f all : $(NAME) $(NAME) : $(OBJS) $(CXX) -o $(NAME) $(OBJS) $(LIBX) clean : find . \( -name "*.o" -o -name "*~" -o -name "#*#" \) -exec $(RM) {} \; fclean : clean $(RM) $(NAME) re : fclean all .PHONY : all \ clean \

What is the meaning of statement below that the declared type shall not be incomplete type

断了今生、忘了曾经 提交于 2020-01-05 03:38:31
问题 The C standard states: If the declaration of an identifier for an object is a tentative definition and has internal linkage, the declared type shall not be an incomplete type What does it mean that "the declared type shall not be an incomplete type"? 回答1: That means you are not allowed to have: static int arr[]; // This is illegal as per the quoted standard. int main(void) {} The array arr is tentatively defined and has an incomplete type (lacks information about the size of the object) and

External linkage of const in C

最后都变了- 提交于 2020-01-03 05:13:17
问题 I was playing with extern keyword in C when I encountered this strange behaviour. I have two files: file1.c #include<stdio.h> int main() { extern int a; a=10; printf("%d",a); return 0; } file2.c const int a=100; When I compile these files together, there is no error or warning and when I run them, output comes to be 10 . I had expected that the compiler should report an error on line a=10; . Moreover, if I change the contents of file2.c to const int a; that is, if I remove the initialization

Using Three20 with another library and conflicting linkage flags

别来无恙 提交于 2020-01-01 07:03:15
问题 I'm trying to add Three20 to my project, but the -ObjC and -all_load flags are messing with another library I'm using. The other library is ZXingWidget for barcode reading, but I don't think that part is relevant. I'm reasonably sure the answer is to use force_load instead of all_load and then point to my three20 libraries, but I can't get it to work. Here's what i'm using now: -force_load ../facebook-three20/Build/Products/Debug-iphonesimulator/*.a But I get an errno=22 build fail

What does the standard say about char arrays as template arguments?

别来无恙 提交于 2020-01-01 04:22:27
问题 During my research for an answer for this question I found (I did not know that before) that gcc and clang allow char arrays to be template arguments if they are declared static . E.g. this code compiles with gcc and clang: #include <type_traits> template <int N, const char (&string)[N]> auto foo() { if constexpr (string[0] == 'i') return 0; else return 3.14f; } void bar() { static constexpr char string1[] = "int"; static constexpr char string2[] = "float"; auto i = foo<sizeof(string1),

What are ld-linux.so.2 and linux-gate.so.1?

筅森魡賤 提交于 2019-12-29 16:26:38
问题 When I run ldd program I get an output of the form linux-gate.so.1 => (0xb77ae000) libstdc++.so.6 => /lib/libstdc++.so.6 (0xb76bc000) libm.so.6 => /lib/libm.so.6 (0xb7691000) libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb7674000) libc.so.6 => /lib/libc.so.6 (0xb74c2000) /lib/ld-linux.so.2 (0xb77af000) Can you explain the output and the reason linux-gate.so.1 and ld-linux.so.2 show differently than other entries? What are their roles? 回答1: I hope that you're not asking about the main entries, which

Link error using templates

爷,独闯天下 提交于 2019-12-29 01:30:47
问题 I converted a function to a template, and started getting this error. I must not be understanding a limitation of templates. Can someone tell me why this is broken? I am receiving this error: Undefined symbols: "bool foo<int>(int const&, int const&)", referenced from: _main in file1.o ld: symbol(s) not found When I link the following code. The code is simplified, but still fails. The first file contains: #include <iostream> template <class T> bool foo (const T&, const T&); int main () { int

Why can't templates be within extern “C” blocks?

不问归期 提交于 2019-12-28 03:03:31
问题 This is a follow-up question to an answer to Is it possible to typedef a pointer-to-extern-“C”-function type within a template? This code fails to compile with g++ , Visual C/C++, and Comeau C/C++ with basically the same error message: #include <cstdlib> extern "C" { static int do_stuff(int) { return 3; } template <typename return_t_, typename arg1_t_> struct test { static void foo(return_t_ (*)(arg1_t_)) { } }; } int main() { test<int, int>::foo(&do_stuff); return EXIT_SUCCESS; } g++ says

Why can't templates be within extern “C” blocks?

戏子无情 提交于 2019-12-28 03:03:04
问题 This is a follow-up question to an answer to Is it possible to typedef a pointer-to-extern-“C”-function type within a template? This code fails to compile with g++ , Visual C/C++, and Comeau C/C++ with basically the same error message: #include <cstdlib> extern "C" { static int do_stuff(int) { return 3; } template <typename return_t_, typename arg1_t_> struct test { static void foo(return_t_ (*)(arg1_t_)) { } }; } int main() { test<int, int>::foo(&do_stuff); return EXIT_SUCCESS; } g++ says